All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@dell.com>
To: dvhart@infradead.org, Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	platform-driver-x86@vger.kernel.org, pali.rohar@gmail.com,
	Mario Limonciello <mario.limonciello@dell.com>
Subject: [PATCH 1/2] platform/x86: dell-wmi-descriptor: check if memory was allocated
Date: Fri,  3 Nov 2017 11:27:21 -0500	[thread overview]
Message-ID: <cf25805c3f247ca5c710ad9971dbc7a50e4c872c.1509725778.git.mario.limonciello@dell.com> (raw)
In-Reply-To: <cover.1509725778.git.mario.limonciello@dell.com>
In-Reply-To: <cover.1509725778.git.mario.limonciello@dell.com>

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>
---
 drivers/platform/x86/dell-wmi-descriptor.c | 5 +++++
 1 file changed, 5 insertions(+)

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;
-- 
2.14.1

  reply	other threads:[~2017-11-03 16:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 16:27 [PATCH 0/2] Account for uncorrectable failures in probing Mario Limonciello
2017-11-03 16:27 ` Mario Limonciello [this message]
2017-11-09 12:07   ` [PATCH 1/2] platform/x86: dell-wmi-descriptor: check if memory was allocated Pali Rohár
2017-11-03 16:27 ` [PATCH 2/2] platform/x86: dell-*wmi*: Relay failed initial probe to dependent drivers Mario Limonciello
2017-11-04  0:53   ` Darren Hart
2017-11-04  3:25     ` Mario.Limonciello
2017-11-04  3:25       ` Mario.Limonciello
2017-11-09 16:02   ` Pali Rohár
2017-11-09 16:13     ` Mario.Limonciello
2017-11-09 16:13       ` Mario.Limonciello
2017-11-09 17:28       ` Pali Rohár
2017-11-09 17:34         ` Mario.Limonciello
2017-11-09 17:34           ` Mario.Limonciello
2017-11-09 17:52           ` Darren Hart
2017-11-07 16:17 ` [PATCH 0/2] Account for uncorrectable failures in probing Mario.Limonciello
2017-11-07 16:17   ` Mario.Limonciello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf25805c3f247ca5c710ad9971dbc7a50e4c872c.1509725778.git.mario.limonciello@dell.com \
    --to=mario.limonciello@dell.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.