From: Dan Carpenter <error27@gmail.com>
To: Jiri Kosina <jkosina@suse.cz>, erazor_de@users.sourceforge.net
Cc: linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] hid: check for kmalloc() failure
Date: Mon, 24 Jan 2011 21:32:13 +0300 [thread overview]
Message-ID: <20110124183213.GA2721@bicker> (raw)
Return -ENOMEM if kmalloc() fails.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
index 1608c8d..c27bc91 100644
--- a/drivers/hid/hid-roccat-koneplus.c
+++ b/drivers/hid/hid-roccat-koneplus.c
@@ -220,6 +220,10 @@ static int koneplus_get_startup_profile(struct usb_device *usb_dev)
int retval;
buf = kmalloc(sizeof(struct koneplus_startup_profile), GFP_KERNEL);
+ if (!buf) {
+ retval = -ENOMEM;
+ goto out;
+ }
retval = koneplus_receive(usb_dev, KONEPLUS_USB_COMMAND_STARTUP_PROFILE,
buf, sizeof(struct koneplus_startup_profile));
next reply other threads:[~2011-01-24 18:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-24 18:32 Dan Carpenter [this message]
2011-01-24 18:44 ` [patch] hid: check for kmalloc() failure Stefan Achatz
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=20110124183213.GA2721@bicker \
--to=error27@gmail.com \
--cc=erazor_de@users.sourceforge.net \
--cc=jkosina@suse.cz \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-input@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).