efivarfs: Use sizeof() instead of magic number
authorMatt Fleming <matt.fleming@intel.com>
Fri, 11 Jan 2013 13:30:46 +0000 (13:30 +0000)
committerMatt Fleming <matt.fleming@intel.com>
Thu, 31 Jan 2013 14:44:44 +0000 (14:44 +0000)
Instead of adding a magic 4 to the variable size, use sizeof() to make
it explicitly clear what the quantity represents (the variable's
attributes).

CC: Jeremy Kerr <jeremy.kerr@canonical.com>
Cc: Chun-Yi Lee <joeyli.kernel@gmail.com>
Cc: Andy Whitcroft <apw@canonical.com>
Reported-by: Lingzhu Xiang <lxiang@redhat.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
drivers/firmware/efivars.c

index f5596db..371c441 100644 (file)
@@ -1076,7 +1076,7 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent)
 
                mutex_lock(&inode->i_mutex);
                inode->i_private = entry;
-               i_size_write(inode, size+4);
+               i_size_write(inode, size + sizeof(entry->var.Attributes));
                mutex_unlock(&inode->i_mutex);
                d_add(dentry, inode);
        }