diff mbox

hid: hid-roccat-koneplus: potential NULL dereference

Message ID 1295258925-31288-1-git-send-email-segoon@openwall.com (mailing list archive)
State Accepted
Commit dacfecdbf3a0a5072984ff8b3c224a48c8461008
Delegated to: Jiri Kosina
Headers show

Commit Message

Vasiliy Kulikov Jan. 17, 2011, 10:08 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
index 1608c8d..591a97c 100644
--- a/drivers/hid/hid-roccat-koneplus.c
+++ b/drivers/hid/hid-roccat-koneplus.c
@@ -220,6 +220,8 @@  static int koneplus_get_startup_profile(struct usb_device *usb_dev)
 	int retval;
 
 	buf = kmalloc(sizeof(struct koneplus_startup_profile), GFP_KERNEL);
+	if (buf == NULL)
+		return -ENOMEM;
 
 	retval = koneplus_receive(usb_dev, KONEPLUS_USB_COMMAND_STARTUP_PROFILE,
 			buf, sizeof(struct koneplus_startup_profile));
@@ -614,6 +616,8 @@  static int koneplus_init_koneplus_device_struct(struct usb_device *usb_dev,
 	mutex_init(&koneplus->koneplus_lock);
 
 	koneplus->startup_profile = koneplus_get_startup_profile(usb_dev);
+	if (koneplus->startup_profile < 0)
+		return koneplus->startup_profile;
 
 	msleep(wait);
 	retval = koneplus_get_info(usb_dev, &koneplus->info);