Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b23cdde4c6240d70bb3d2e3c4046b60d6f6c8451
Commit:     b23cdde4c6240d70bb3d2e3c4046b60d6f6c8451
Parent:     4c75f7416f51b0c6855952467a5db04f9c598f09
Author:     Joel Becker <[EMAIL PROTECTED]>
AuthorDate: Fri Jun 22 13:07:02 2007 -0700
Committer:  Mark Fasheh <[EMAIL PROTECTED]>
CommitDate: Tue Jul 10 16:52:22 2007 -0700

    configfs: consistent attribute size
    
    The attribute store/show code currently limits attributes at PAGE_SIZE.
    This code comes from sysfs, where it still works that way.
    
    However, PAGE_SIZE is not constant.  A 16k attribute string works on
    ia64 but not on x86.  Really a subsystem shouldn't allow different
    attribute sizes based on platform.
    
    As such, limit all simple attributes to 4k.  This works on all
    platforms, and is consistent with all current code.
    
    Signed-off-by: Joel Becker <[EMAIL PROTECTED]>
    Signed-off-by: Mark Fasheh <[EMAIL PROTECTED]>
---
 fs/configfs/file.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index 3527c7c..0f4b65e 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -33,6 +33,13 @@
 #include <linux/configfs.h>
 #include "configfs_internal.h"
 
+/*
+ * A simple attribute can only be 4096 characters.  Why 4k?  Because the
+ * original code limited it to PAGE_SIZE.  That's a bad idea, though,
+ * because an attribute of 16k on ia64 won't work on x86.  So we limit to
+ * 4k, our minimum common page size.
+ */
+#define SIMPLE_ATTR_SIZE 4096
 
 struct configfs_buffer {
        size_t                  count;
@@ -69,7 +76,7 @@ static int fill_read_buffer(struct dentry * dentry, struct 
configfs_buffer * buf
 
        count = ops->show_attribute(item,attr,buffer->page);
        buffer->needs_read_fill = 0;
-       BUG_ON(count > (ssize_t)PAGE_SIZE);
+       BUG_ON(count > (ssize_t)SIMPLE_ATTR_SIZE);
        if (count >= 0)
                buffer->count = count;
        else
@@ -137,8 +144,8 @@ fill_write_buffer(struct configfs_buffer * buffer, const 
char __user * buf, size
        if (!buffer->page)
                return -ENOMEM;
 
-       if (count >= PAGE_SIZE)
-               count = PAGE_SIZE - 1;
+       if (count >= SIMPLE_ATTR_SIZE)
+               count = SIMPLE_ATTR_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,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to