]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
platform/x86: dell-wmi: check for kmalloc() errors
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 11 Dec 2017 10:54:27 +0000 (13:54 +0300)
committerDarren Hart (VMware) <dvhart@infradead.org>
Tue, 12 Dec 2017 01:26:03 +0000 (17:26 -0800)
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@oracle.com>
Reviewed-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
drivers/platform/x86/dell-wmi.c

index 39d2f451848332d8346201b9cc1cd08bb5e10427..fb25b20df316f39140a3af0f974e9f1fa30aabff 100644 (file)
@@ -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;