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, 23 Jul 2015 08:19:13 +0200
From:	Pavel Machek <pavel@....cz>
To:	Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:	Vlastimil Babka <vbabka@...e.cz>, Jiri Kosina <jkosina@...e.com>,
	Samuel Thibault <samuel.thibault@...-lyon.org>,
	Pali Rohár <pali.rohar@...il.com>,
	linux-input@...r.kernel.org, rpurdie@...ys.net,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Input: LEDs - skip unnamed LEDs

On Wed 2015-07-22 15:02:02, Dmitry Torokhov wrote:
> Devices may declare more LEDs than what is known to input-leds
> (HID does this for some devices). Instead of showing ugly warnings
> on connect and, even worse, oopsing on disconnect, let's simply
> ignore LEDs that are not known to us.
> 
> Reported-by: Vlastimil Babka <vbabka@...e.cz>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
> ---
>  drivers/input/input-leds.c |   16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c
> index 074a65e..766bf26 100644
> --- a/drivers/input/input-leds.c
> +++ b/drivers/input/input-leds.c
> @@ -71,6 +71,18 @@ static void input_leds_event(struct input_handle *handle, unsigned int type,
>  {
>  }
>  
> +static int input_leds_get_count(struct input_dev *dev)
> +{
> +	unsigned int led_code;
> +	int count = 0;
> +
> +	for_each_set_bit(led_code, dev->ledbit, LED_CNT)
> +		if (input_led_info[led_code].name)
> +			count++;
> +
> +	return count;
> +}
> +
>  static int input_leds_connect(struct input_handler *handler,
>  			      struct input_dev *dev,
>  			      const struct input_device_id *id)
> @@ -81,7 +93,7 @@ static int input_leds_connect(struct input_handler *handler,
>  	int led_no;
>  	int error;
>  
> -	num_leds = bitmap_weight(dev->ledbit, LED_CNT);
> +	num_leds = input_leds_get_count(dev);
>  	if (!num_leds)
>  		return -ENXIO;
>  
> @@ -112,7 +124,7 @@ static int input_leds_connect(struct input_handler *handler,
>  		led->handle = &leds->handle;
>  		led->code = led_code;
>  
> -		if (WARN_ON(!input_led_info[led_code].name))
> +		if (!input_led_info[led_code].name)
>  			continue;
>  
>  		led->cdev.name = kasprintf(GFP_KERNEL, "%s::%s",
>

Are you sure? AFAICT you need to fix err_unregister_leds not to
unregister leds with no name...

									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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