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: Thu, 28 Dec 2023 23:42:08 -0800
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Markus Elfring <Markus.Elfring@....de>
Cc: linux-input@...r.kernel.org, kernel-janitors@...r.kernel.org,
	Oliver Graute <oliver.graute@...oconnector.com>,
	Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
	ye xingchen <ye.xingchen@....com.cn>,
	LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: Re: [PATCH] Input: usbtouchscreen - Return directly after a failed
 kmalloc() in nexio_init()

On Tue, Dec 26, 2023 at 09:08:12PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Tue, 26 Dec 2023 21:00:25 +0100
> 
> The kfree() function was called in one case by
> the nexio_init() function during error handling
> even if the passed variable contained a null pointer.

Which is perfectly valid thing to do, like free(), kfree() accepts NULL
argument.

> This issue was detected by using the Coccinelle software.

This tells me precisely nothing.

> 
> Thus return directly after a call of the function “kmalloc” failed
> at the beginning.

This is simply a matter of preference, the original author preferred
that style, I see no objective reason to change it.

> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/input/touchscreen/usbtouchscreen.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
> index 60354ebc7242..1873c7918a78 100644
> --- a/drivers/input/touchscreen/usbtouchscreen.c
> +++ b/drivers/input/touchscreen/usbtouchscreen.c
> @@ -977,7 +977,7 @@ static int nexio_init(struct usbtouch_usb *usbtouch)
> 
>  	buf = kmalloc(NEXIO_BUFSIZE, GFP_NOIO);
>  	if (!buf)
> -		goto out_buf;
> +		return ret;
> 
>  	/* two empty reads */
>  	for (i = 0; i < 2; i++) {
> --
> 2.43.0
> 

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ