lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 19 Nov 2013 17:06:31 -0800
From:	Davidlohr Bueso <davidlohr@...com>
To:	amiettinen@...dia.com
Cc:	axboe@...nel.dk, akpm@...ux-foundation.org, matt.fleming@...el.com,
	kzak@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs: partitions: efi: Fix bound check

On Fri, 2013-11-15 at 19:14 +0200, Antti P Miettinen wrote:
> Use ARRAY_SIZE instead of sizeof to get proper max for label
> length.
> 
> Signed-off-by: Antti P Miettinen <amiettinen@...dia.com>
> Reviewed-by: Hiroshi Doyu <hdoyu@...dia.com>
> Tested-by: Hiroshi Doyu <hdoyu@...dia.com>

I haven't tested the patch, but using ARRAY_SIZE for fields defined as
arrays does make more sense than sizeof.

Acked-by: Davidlohr Bueso <davidlohr@...com>

> ---
>  block/partitions/efi.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/block/partitions/efi.c b/block/partitions/efi.c
> index a8287b4..dc51f46 100644
> --- a/block/partitions/efi.c
> +++ b/block/partitions/efi.c
> @@ -96,6 +96,7 @@
>   * - Code works, detects all the partitions.
>   *
>   ************************************************************/
> +#include <linux/kernel.h>
>  #include <linux/crc32.h>
>  #include <linux/ctype.h>
>  #include <linux/math64.h>
> @@ -715,8 +716,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;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ