summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorAntti P Miettinen <amiettinen@nvidia.com>2013-11-05 20:30:10 +0200
committerHiroshi Doyu <hdoyu@nvidia.com>2013-11-05 23:15:43 -0800
commitc849795ceb9735c07685c01a7b1a855e336dbb51 (patch)
treed79c7dbbdbd87d6b92ae25934e4a30e102522fc0 /block
parent1c101e8634a0b0145ed509a6123da4a56b12fd79 (diff)
fs: partitions: efi: Fix bound check
Use ARRAY_SIZE instead of sizeof to get proper max for label length. Bug 1401569 Change-Id: I98cfcca33bb8da18a791750ba8fa85d76a9afc05 Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com> Reviewed-on: http://git-master/r/326759 GVS: Gerrit_Virtual_Submit Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com> Tested-by: Hiroshi Doyu <hdoyu@nvidia.com>
Diffstat (limited to 'block')
-rw-r--r--block/partitions/efi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index f318732cef4b..894174ca6773 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -93,6 +93,7 @@
* - Code works, detects all the partitions.
*
************************************************************/
+#include <linux/kernel.h>
#include <linux/crc32.h>
#include <linux/ctype.h>
#include <linux/math64.h>
@@ -670,8 +671,8 @@ int efi_partition(struct parsed_partitions *state)
efi_guid_unparse(&ptes[i].unique_partition_guid, info->uuid);
/* Naively convert UTF16-LE to 7 bits. */
- label_max = min(sizeof(info->volname) - 1,
- sizeof(ptes[i].partition_name));
+ label_max = min(ARRAY_SIZE(info->volname) - 1,
+ ARRAY_SIZE(ptes[i].partition_name));
info->volname[label_max] = 0;
while (label_count < label_max) {
u8 c = ptes[i].partition_name[label_count] & 0xff;