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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 15 Jun 2023 14:02:46 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Claudiu Beznea <claudiu.beznea@...rochip.com>
Cc:     ludovic.desroches@...rochip.com, linus.walleij@...aro.org,
        nicolas.ferre@...rochip.com, alexandre.belloni@...tlin.com,
        lars.povlsen@...rochip.com, Steen.Hegelund@...rochip.com,
        daniel.machon@...rochip.com, UNGLinuxDriver@...rochip.com,
        linux-arm-kernel@...ts.infradead.org, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] pinctrl: mcp23s08: check return value of
 devm_kasprintf()

On Thu, Jun 15, 2023 at 01:53:31PM +0300, Claudiu Beznea wrote:
> devm_kasprintf() returns a pointer to dynamically allocated memory.
> Pointer could be NULL in case allocation fails. Check pointer validity.
> Identified with coccinelle (kmerr.cocci script).

Not that this may happen, but okay.

...

> @@ -119,6 +119,9 @@ static int mcp23s08_spi_regmap_init(struct mcp23s08 *mcp, struct device *dev,
>  		return -EINVAL;
>  	}
>  
> +	if (!name || !mcp->chip.label)
> +		return -ENOMEM;

I prefer to see 4 independent checks for each of the devm_kasprintf() calls.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ