summaryrefslogtreecommitdiff
path: root/drivers/firmware/efivars.c
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-10-22 18:23:29 +0400
committerMatt Fleming <matt.fleming@intel.com>2012-10-30 14:39:26 +0400
commitd292384152fdd465dba792d555ce5db83e94efa0 (patch)
tree9d221602e997270c66aa4565bc1d73280cbf5098 /drivers/firmware/efivars.c
parent7253eaba7b179db2e07e67c5b78d5f10b332291d (diff)
downloadlinux-d292384152fdd465dba792d555ce5db83e94efa0.tar.xz
efivarfs: Replace magic number with sizeof(attributes)
Seeing "+ 4" littered throughout the functions gets a bit confusing. Use "sizeof(attributes)" which clearly explains what quantity we're adding. Acked-by: Jeremy Kerr <jeremy.kerr@canonical.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'drivers/firmware/efivars.c')
-rw-r--r--drivers/firmware/efivars.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 277e42616f0d..2c044343c99b 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -801,7 +801,7 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf,
if (status != EFI_BUFFER_TOO_SMALL)
return efi_status_to_err(status);
- data = kmalloc(datasize + 4, GFP_KERNEL);
+ data = kmalloc(datasize + sizeof(attributes), GFP_KERNEL);
if (!data)
return -ENOMEM;
@@ -810,7 +810,7 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf,
status = efivars->ops->get_variable(var->var.VariableName,
&var->var.VendorGuid,
&attributes, &datasize,
- (data + 4));
+ (data + sizeof(attributes)));
spin_unlock(&efivars->lock);
if (status != EFI_SUCCESS) {
@@ -818,9 +818,9 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf,
goto out_free;
}
- memcpy(data, &attributes, 4);
+ memcpy(data, &attributes, sizeof(attributes));
size = simple_read_from_buffer(userbuf, count, ppos,
- data, datasize + 4);
+ data, datasize + sizeof(attributes));
out_free:
kfree(data);