linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: hid-logitech-hidpp: add NULL check on devm_kmemdup() return value
@ 2017-07-07  5:12 Gustavo A. R. Silva
  2017-07-12  7:40 ` Benjamin Tissoires
  2017-07-20 13:46 ` Jiri Kosina
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2017-07-07  5:12 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires
  Cc: linux-input, linux-kernel, Gustavo A. R. Silva

Check return value from call to devm_kmemdup()
in order to prevent a NULL pointer dereference.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/hid/hid-logitech-hidpp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 41b3946..501e16a 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -2732,6 +2732,9 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
 				     hidpp_battery_props,
 				     sizeof(hidpp_battery_props),
 				     GFP_KERNEL);
+	if (!battery_props)
+		return -ENOMEM;
+
 	num_battery_props = ARRAY_SIZE(hidpp_battery_props) - 2;
 
 	if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE)
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] HID: hid-logitech-hidpp: add NULL check on devm_kmemdup() return value
  2017-07-07  5:12 [PATCH] HID: hid-logitech-hidpp: add NULL check on devm_kmemdup() return value Gustavo A. R. Silva
@ 2017-07-12  7:40 ` Benjamin Tissoires
  2017-07-17  5:00   ` Gustavo A. R. Silva
  2017-07-20 13:46 ` Jiri Kosina
  1 sibling, 1 reply; 4+ messages in thread
From: Benjamin Tissoires @ 2017-07-12  7:40 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Jiri Kosina, linux-input, linux-kernel

On Jul 07 2017 or thereabouts, Gustavo A. R. Silva wrote:
> Check return value from call to devm_kmemdup()
> in order to prevent a NULL pointer dereference.
> 
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

>  drivers/hid/hid-logitech-hidpp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 41b3946..501e16a 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -2732,6 +2732,9 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
>  				     hidpp_battery_props,
>  				     sizeof(hidpp_battery_props),
>  				     GFP_KERNEL);
> +	if (!battery_props)
> +		return -ENOMEM;
> +
>  	num_battery_props = ARRAY_SIZE(hidpp_battery_props) - 2;
>  
>  	if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE)
> -- 
> 2.5.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] HID: hid-logitech-hidpp: add NULL check on devm_kmemdup() return value
  2017-07-12  7:40 ` Benjamin Tissoires
@ 2017-07-17  5:00   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2017-07-17  5:00 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: Jiri Kosina, linux-input, linux-kernel



On 07/12/2017 02:40 AM, Benjamin Tissoires wrote:
> On Jul 07 2017 or thereabouts, Gustavo A. R. Silva wrote:
>> Check return value from call to devm_kmemdup()
>> in order to prevent a NULL pointer dereference.
>>
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>> ---
>
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>

Thank you, Benjamin.

>>  drivers/hid/hid-logitech-hidpp.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
>> index 41b3946..501e16a 100644
>> --- a/drivers/hid/hid-logitech-hidpp.c
>> +++ b/drivers/hid/hid-logitech-hidpp.c
>> @@ -2732,6 +2732,9 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
>>  				     hidpp_battery_props,
>>  				     sizeof(hidpp_battery_props),
>>  				     GFP_KERNEL);
>> +	if (!battery_props)
>> +		return -ENOMEM;
>> +
>>  	num_battery_props = ARRAY_SIZE(hidpp_battery_props) - 2;
>>
>>  	if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE)
>> --
>> 2.5.0
>>

-- 
Gustavo A. R. Silva

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] HID: hid-logitech-hidpp: add NULL check on devm_kmemdup() return value
  2017-07-07  5:12 [PATCH] HID: hid-logitech-hidpp: add NULL check on devm_kmemdup() return value Gustavo A. R. Silva
  2017-07-12  7:40 ` Benjamin Tissoires
@ 2017-07-20 13:46 ` Jiri Kosina
  1 sibling, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2017-07-20 13:46 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Benjamin Tissoires, linux-input, linux-kernel, Jiri Kosina

On Fri, 7 Jul 2017, Gustavo A. R. Silva wrote:

> Check return value from call to devm_kmemdup()
> in order to prevent a NULL pointer dereference.
> 
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/hid/hid-logitech-hidpp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 41b3946..501e16a 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -2732,6 +2732,9 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
>  				     hidpp_battery_props,
>  				     sizeof(hidpp_battery_props),
>  				     GFP_KERNEL);
> +	if (!battery_props)
> +		return -ENOMEM;
> +

Applied to for-4.13/upstream-fixes, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-20 13:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-07  5:12 [PATCH] HID: hid-logitech-hidpp: add NULL check on devm_kmemdup() return value Gustavo A. R. Silva
2017-07-12  7:40 ` Benjamin Tissoires
2017-07-17  5:00   ` Gustavo A. R. Silva
2017-07-20 13:46 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).