mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
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>
This commit is contained in:
parent
73ed298b06
commit
8b9528a6d9
1 changed files with 5 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue