Skip to contentSkip to conversation

configfs: use capped length for ->store_attribute()

PATCH In review Dan Carpenter 2 participants 3 messages Apr 30, 2013 – May 2, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configfs: use capped length for ->store_attribute()

The difference between "count" and "len" is that "len" is capped at 4095. Changing it like this makes it match how sysfs_write_file() is implemented.

---
This is a static analysis patch. I haven't found any store_attribute() functions where this change makes a difference.

fs/configfs/file.c +1 -1
index 2b6cb23..1d1c41f 100644
@@ -203,7 +203,7 @@ configfs_write_file(struct file *file, const char __user *buf, size_t count, lof
 	mutex_lock(&buffer->mutex);
 	len = fill_write_buffer(buffer, buf, count);
 	if (len > 0)
-		len = flush_write_buffer(file->f_path.dentry, buffer, count);
+		len = flush_write_buffer(file->f_path.dentry, buffer, len);
 	if (len > 0)
 		*ppos += len;
 	mutex_unlock(&buffer->mutex);
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

The difference between "count" and "len" is that "len" is capped at 4095. Changing it like this makes it match how sysfs_write_file() is implemented.

Do you want me to push this up, or will you be sending it?

Joel

Quoted 17 lines

---
This is a static analysis patch. I haven't found any store_attribute() functions where this change makes a difference.

fs/configfs/file.c +1 -1
index 2b6cb23..1d1c41f 100644
@@ -203,7 +203,7 @@ configfs_write_file(struct file *file, const char __user *buf, size_t count, lof
 	mutex_lock(&buffer->mutex);
 	len = fill_write_buffer(buffer, buf, count);
 	if (len > 0)
-		len = flush_write_buffer(file->f_path.dentry, buffer, count);
+		len = flush_write_buffer(file->f_path.dentry, buffer, len);
 	if (len > 0)
 		*ppos += len;
 	mutex_unlock(&buffer->mutex);
Signature · 5 lines
"In the room the women come and go
 Talking of Michaelangelo."

			http://www.jlbec.org/
			[email protected]
#2 lore raw
Quoted 10 lines · Joel Becker
Quoted 5 lines · Dan Carpenter

The difference between "count" and "len" is that "len" is capped at 4095. Changing it like this makes it match how sysfs_write_file() is implemented.

Do you want me to push this up, or will you be sending it?

Could you push it?

regards,
dan carpenter