linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] hid: check for kmalloc() failure
@ 2011-01-24 18:32 Dan Carpenter
  2011-01-24 18:44 ` Stefan Achatz
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-01-24 18:32 UTC (permalink / raw)
  To: Jiri Kosina, erazor_de; +Cc: linux-input, kernel-janitors

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-24 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-24 18:32 [patch] hid: check for kmalloc() failure Dan Carpenter
2011-01-24 18:44 ` Stefan Achatz

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).