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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 15 Apr 2019 14:02:26 +0800
From:   Liang Yang <liang.yang@...ogic.com>
To:     Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
        <linux-amlogic@...ts.infradead.org>,
        <linux-mtd@...ts.infradead.org>, <richard@....at>,
        <miquel.raynal@...tlin.com>
CC:     <linux-arm-kernel@...ts.infradead.org>, <marek.vasut@...il.com>,
        <linux-kernel@...r.kernel.org>, <computersforpeace@...il.com>,
        <dwmw2@...radead.org>, <bbrezillon@...nel.org>,
        <jianxin.pan@...ogic.com>
Subject: Re: [PATCH 2/4] mtd: rawnand: meson: use
 of_property_count_elems_of_size helper


On 2019/4/12 6:00, Martin Blumenstingl wrote:
> Use the of_property_count_elems_of_size() helper instead of open-coding
> it's logic. As a bonus this will now error out if the "reg" property
> values use an incorrect size (anything other than sizeof(u32)).
> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
> ---
>   drivers/mtd/nand/raw/meson_nand.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
> index c1a6af57dab5..9a6023638101 100644
> --- a/drivers/mtd/nand/raw/meson_nand.c
> +++ b/drivers/mtd/nand/raw/meson_nand.c
> @@ -1233,10 +1233,7 @@ meson_nfc_nand_chip_init(struct device *dev,
>   	int ret, i;
>   	u32 tmp, nsels;
>   
> -	if (!of_get_property(np, "reg", &nsels))
> -		return -EINVAL;
> -
> -	nsels /= sizeof(u32);
> +	nsels = of_property_count_elems_of_size(np, "reg", sizeof(u32));
Tested-by:Liang Yang <liang.yang@...ogic.com>
Acked-by: Liang Yang <liang.yang@...ogic.com>
>   	if (!nsels || nsels > MAX_CE_NUM) {
>   		dev_err(dev, "invalid register property size\n");
>   		return -EINVAL;
> 

Powered by blists - more mailing lists