mbox series

[0/3] pinctrl: check memory returned by devm_kasprintf()

Message ID 20230615105333.585304-1-claudiu.beznea@microchip.com (mailing list archive)
Headers show
Series pinctrl: check memory returned by devm_kasprintf() | expand

Message

Claudiu Beznea June 15, 2023, 10:53 a.m. UTC
Hi,

While browsing some code I noticed that there are places where pointer
returned by devm_kasprintf() or kasprintf() is not checked. Thus I've
tooked the chance and fixed this (by updating kmerr.cocci script,
changes published at [1]).

Thank you,
Claudiu Beznea

[1] https://lore.kernel.org/all/20230530074044.1603426-1-claudiu.beznea@microchip.com/

Claudiu Beznea (3):
  pinctrl: mcp23s08: check return value of {devm_}kasprintf()
  pinctrl: microchip-sgpio: check return value of devm_kasprintf()
  pinctrl: at91-pio4: check return value of devm_kasprintf()

 drivers/pinctrl/pinctrl-at91-pio4.c       | 2 ++
 drivers/pinctrl/pinctrl-mcp23s08_spi.c    | 3 +++
 drivers/pinctrl/pinctrl-microchip-sgpio.c | 3 +++
 3 files changed, 8 insertions(+)

Comments

Andy Shevchenko June 15, 2023, 11:05 a.m. UTC | #1
On Thu, Jun 15, 2023 at 01:53:30PM +0300, Claudiu Beznea wrote:
> Hi,
> 
> While browsing some code I noticed that there are places where pointer
> returned by devm_kasprintf() or kasprintf() is not checked. Thus I've
> tooked the chance and fixed this (by updating kmerr.cocci script,
> changes published at [1]).

Thank you for fixing this!
Individual patches are commented by me.

> [1] https://lore.kernel.org/all/20230530074044.1603426-1-claudiu.beznea@microchip.com/
> 
> Claudiu Beznea (3):
>   pinctrl: mcp23s08: check return value of {devm_}kasprintf()
>   pinctrl: microchip-sgpio: check return value of devm_kasprintf()
>   pinctrl: at91-pio4: check return value of devm_kasprintf()
> 
>  drivers/pinctrl/pinctrl-at91-pio4.c       | 2 ++
>  drivers/pinctrl/pinctrl-mcp23s08_spi.c    | 3 +++
>  drivers/pinctrl/pinctrl-microchip-sgpio.c | 3 +++
>  3 files changed, 8 insertions(+)
> 
> -- 
> 2.34.1
>
Linus Walleij June 16, 2023, 1:02 p.m. UTC | #2
Hi Claudiu,

thanks for your patches!

On Thu, Jun 15, 2023 at 12:53 PM Claudiu Beznea
<claudiu.beznea@microchip.com> wrote:

> While browsing some code I noticed that there are places where pointer
> returned by devm_kasprintf() or kasprintf() is not checked. Thus I've
> tooked the chance and fixed this (by updating kmerr.cocci script,
> changes published at [1]).

I applied patch 2/3 and 3/3 you only need to resent the first patch
after looking into the comments from Andy.

Yours,
Linus Walleij