]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/sysfs/file.c
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6-omap-h63xx.git] / fs / sysfs / file.c
index cf3786625bfade2ec42b0bcebcd6b0c72771ff21..95c165101c98d16e7a6e537ff6b54a2a95b6ccc2 100644 (file)
@@ -157,8 +157,8 @@ sysfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos)
                if ((retval = fill_read_buffer(file->f_dentry,buffer)))
                        goto out;
        }
-       pr_debug("%s: count = %d, ppos = %lld, buf = %s\n",
-                __FUNCTION__,count,*ppos,buffer->page);
+       pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n",
+                __FUNCTION__, count, *ppos, buffer->page);
        retval = flush_read_buffer(buffer,buf,count,ppos);
 out:
        up(&buffer->sem);
@@ -190,6 +190,9 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char __user * buf, size_t
                count = PAGE_SIZE - 1;
        error = copy_from_user(buffer->page,buf,count);
        buffer->needs_read_fill = 1;
+       /* if buf is assumed to contain a string, terminate it by \0,
+          so e.g. sscanf() can scan the string easily */
+       buffer->page[count] = 0;
        return error ? -EFAULT : count;
 }
 
@@ -483,17 +486,12 @@ int sysfs_update_file(struct kobject * kobj, const struct attribute * attr)
                    (victim->d_parent->d_inode == dir->d_inode)) {
                        victim->d_inode->i_mtime = CURRENT_TIME;
                        fsnotify_modify(victim);
-
-                       /**
-                        * Drop reference from initial sysfs_get_dentry().
-                        */
-                       dput(victim);
                        res = 0;
                } else
                        d_drop(victim);
                
                /**
-                * Drop the reference acquired from sysfs_get_dentry() above.
+                * Drop the reference acquired from lookup_one_len() above.
                 */
                dput(victim);
        }