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]
Message-ID: <20101201171114.GA11196@core.coreip.homeip.net>
Date:	Wed, 1 Dec 2010 09:11:14 -0800
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Namhyung Kim <namhyung@...il.com>
Cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	Jan Kratochvil <honza@...os.cz>
Subject: Re: [PATCH 2/2] Input: xpad - sanitize xpad_led_disconnect()

Hi Namhyung,

On Thu, Dec 02, 2010 at 12:04:34AM +0900, Namhyung Kim wrote:
> IMHO kfree() here looks very confusing. xpad_led->name is an array
> of char inside struct xpad_led and is not a dynamic memory itself.
> But kfree() works well because it is a first member of the struct
> so it points start address of the struct and frees the struct.

This has already been fixed in my tree, thanks.

> 
> Change it to xpad_led for the correctness & readability and make
> xpad->led NULL for the safety.
> 
> Signed-off-by: Namhyung Kim <namhyung@...il.com>
> Cc: Jan Kratochvil <honza@...os.cz>
> ---
>  drivers/input/joystick/xpad.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index f885902..1ca49e8 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -728,7 +728,8 @@ static void xpad_led_disconnect(struct usb_xpad *xpad)
>  
>  	if (xpad_led) {
>  		led_classdev_unregister(&xpad_led->led_cdev);
> -		kfree(xpad_led->name);
> +		kfree(xpad_led);
> +		xpad->led = NULL;
>  	}
>  }
>  #else
> -- 
> 1.7.0.4
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ