diff options
author | Mario Limonciello <mario.limonciello@dell.com> | 2017-11-09 18:49:09 +0100 |
---|---|---|
committer | Darren Hart (VMware) <dvhart@infradead.org> | 2017-11-17 02:45:26 +0100 |
commit | 8b9528a6d9a901b9f933231505fef5630e80ce5a (patch) | |
tree | 3e6d5a9ea96b58b7e90f1459ef0dd7f6cc2e14c6 /drivers | |
parent | platform/x86: Revert intel_pmc_ipc: Use MFD framework to create dependent dev... (diff) | |
download | linux-8b9528a6d9a901b9f933231505fef5630e80ce5a.tar.xz linux-8b9528a6d9a901b9f933231505fef5630e80ce5a.zip |
platform/x86: dell-wmi-descriptor: check if memory was allocated
devm_kzalloc will return NULL pointer if no memory was allocated.
This should be checked. This problem also existed when the driver
was dell-wmi.c.
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/platform/x86/dell-wmi-descriptor.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/platform/x86/dell-wmi-descriptor.c b/drivers/platform/x86/dell-wmi-descriptor.c index 3204c408e261..28ef5f37cfbf 100644 --- a/drivers/platform/x86/dell-wmi-descriptor.c +++ b/drivers/platform/x86/dell-wmi-descriptor.c @@ -121,6 +121,11 @@ static int dell_wmi_descriptor_probe(struct wmi_device *wdev) priv = devm_kzalloc(&wdev->dev, sizeof(struct descriptor_priv), GFP_KERNEL); + if (!priv) { + ret = -ENOMEM; + goto out; + } + priv->interface_version = buffer[2]; priv->size = buffer[3]; ret = 0; |