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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160427095450.5f45b3af@bbrezillon>
Date:	Wed, 27 Apr 2016 09:54:50 +0200
From:	Boris Brezillon <boris.brezillon@...e-electrons.com>
To:	Rafał Miłecki <zajec5@...il.com>
Cc:	linux-mtd@...ts.infradead.org, Richard Weinberger <richard@....at>,
	David Woodhouse <dwmw2@...radead.org>,
	Brian Norris <computersforpeace@...il.com>,
	linux-kernel@...r.kernel.org (open list)
Subject: Re: [PATCH V2] mtd: nand: fix NULL pointer dereference in
 of_get_nand_ecc_algo

On Tue, 26 Apr 2016 23:16:47 +0200
Rafał Miłecki <zajec5@...il.com> wrote:

> Our array nand_ecc_algos doesn't specify mappings for all available
> enum nand_ecc_algo values. The one missing there is NAND_ECC_UNKNOWN
> as this value is reserved for algorithm not being specified at all.
> It means we have to be careful when iterating this array and avoid
> NULL values.
> 
> Signed-off-by: Rafał Miłecki <zajec5@...il.com>

Changes squashed into "mtd: nand: add support for "nand-ecc-algo" DT
property".

Thanks,

Boris

> ---
> V2: Iterate from NAND_ECC_HAMMING instead of checking for NULL as preferred by
> Boris.
> ---
>  drivers/mtd/nand/nand_base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index a5417a0..2e6ba44 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -4015,7 +4015,7 @@ static int of_get_nand_ecc_algo(struct device_node *np)
>  
>  	err = of_property_read_string(np, "nand-ecc-algo", &pm);
>  	if (!err) {
> -		for (i = 0; i < ARRAY_SIZE(nand_ecc_algos); i++)
> +		for (i = NAND_ECC_HAMMING; i < ARRAY_SIZE(nand_ecc_algos); i++)
>  			if (!strcasecmp(pm, nand_ecc_algos[i]))
>  				return i;
>  		return -ENODEV;



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ