RE: [PATCH] platform/x86: dell-wmi: check for kmalloc() errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@xxxxxxxxxx]
> Sent: Monday, December 11, 2017 4:54 AM
> To: Matthew Garrett <mjg59@xxxxxxxxxxxxx>; Limonciello, Mario
> <Mario_Limonciello@xxxxxxxx>
> Cc: Pali Rohár <pali.rohar@xxxxxxxxx>; Darren Hart <dvhart@xxxxxxxxxxxxx>;
> Andy Shevchenko <andy@xxxxxxxxxxxxx>; platform-driver-x86@xxxxxxxxxxxxxxx;
> kernel-janitors@xxxxxxxxxxxxxxx
> Subject: [PATCH] platform/x86: dell-wmi: check for kmalloc() errors
> 
> This allocation won't fail in the current kernel because it's small but
> not checking for kmalloc() failures introduces static checker warnings
> so let's fix it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
> index 39d2f4518483..fb25b20df316 100644
> --- a/drivers/platform/x86/dell-wmi.c
> +++ b/drivers/platform/x86/dell-wmi.c
> @@ -639,6 +639,8 @@ static int dell_wmi_events_set_enabled(bool enable)
>  	int ret;
> 
>  	buffer = kzalloc(sizeof(struct calling_interface_buffer), GFP_KERNEL);
> +	if (!buffer)
> +		return -ENOMEM;
>  	buffer->cmd_class = CLASS_INFO;
>  	buffer->cmd_select = SELECT_APP_REGISTRATION;
>  	buffer->input[0] = 0x10000;

Thanks for that.

Reviewed-by: Mario Limonciello <mario.limonciello@xxxxxxxx>




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux