diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-10-22 10:23:29 -0400 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-10-30 06:39:26 -0400 |
commit | d292384152fdd465dba792d555ce5db83e94efa0 (patch) | |
tree | 9d221602e997270c66aa4565bc1d73280cbf5098 /drivers/firmware | |
parent | 7253eaba7b179db2e07e67c5b78d5f10b332291d (diff) |
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')
-rw-r--r-- | drivers/firmware/efivars.c | 8 |
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, | |||
801 | if (status != EFI_BUFFER_TOO_SMALL) | 801 | if (status != EFI_BUFFER_TOO_SMALL) |
802 | return efi_status_to_err(status); | 802 | return efi_status_to_err(status); |
803 | 803 | ||
804 | data = kmalloc(datasize + 4, GFP_KERNEL); | 804 | data = kmalloc(datasize + sizeof(attributes), GFP_KERNEL); |
805 | 805 | ||
806 | if (!data) | 806 | if (!data) |
807 | return -ENOMEM; | 807 | return -ENOMEM; |
@@ -810,7 +810,7 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf, | |||
810 | status = efivars->ops->get_variable(var->var.VariableName, | 810 | status = efivars->ops->get_variable(var->var.VariableName, |
811 | &var->var.VendorGuid, | 811 | &var->var.VendorGuid, |
812 | &attributes, &datasize, | 812 | &attributes, &datasize, |
813 | (data + 4)); | 813 | (data + sizeof(attributes))); |
814 | spin_unlock(&efivars->lock); | 814 | spin_unlock(&efivars->lock); |
815 | 815 | ||
816 | if (status != EFI_SUCCESS) { | 816 | if (status != EFI_SUCCESS) { |
@@ -818,9 +818,9 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf, | |||
818 | goto out_free; | 818 | goto out_free; |
819 | } | 819 | } |
820 | 820 | ||
821 | memcpy(data, &attributes, 4); | 821 | memcpy(data, &attributes, sizeof(attributes)); |
822 | size = simple_read_from_buffer(userbuf, count, ppos, | 822 | size = simple_read_from_buffer(userbuf, count, ppos, |
823 | data, datasize + 4); | 823 | data, datasize + sizeof(attributes)); |
824 | out_free: | 824 | out_free: |
825 | kfree(data); | 825 | kfree(data); |
826 | 826 | ||