From patchwork Mon Jan 17 10:08:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasiliy Kulikov X-Patchwork-Id: 483491 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0HA9dsr008055 for ; Mon, 17 Jan 2011 10:09:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752530Ab1AQKIw (ORCPT ); Mon, 17 Jan 2011 05:08:52 -0500 Received: from mail-ey0-f174.google.com ([209.85.215.174]:54738 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751878Ab1AQKIu (ORCPT ); Mon, 17 Jan 2011 05:08:50 -0500 Received: by mail-ey0-f174.google.com with SMTP id 27so2387511eye.19 for ; Mon, 17 Jan 2011 02:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer; bh=SCHrfBDJqXj8DvVhiJMjrrh/PgYaspbmzWMG8A15umA=; b=GQW1eYyFWHEq8C9O0MSrcCW5G/+0Ex3H7USzaaYie+7kY4GrNfC+C9NpDbuOo0Se3H kgq2bLwD5Mk0Tb8X013fTNpo9LNNIlZYbHjsugCzn3GFYwZifC2Zwc0679HdPtZLBKqv rVwYIh7tT+7mLaSlUVIKk99imAFJGfd1YuX1Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; b=airJ/WzOc/yVbw4WL+7IyVD1kROvN0DL+h2tNogjoIQkD4qxQIe1tU6IOcxHBajDmL dVpClwPoUTAzvu1/g4RtU8TL3qOLVh3yJiDNucSLI7/fDBJp6LuvBKxHdjsSkSXHhDq4 pYmFg7vUg9+JeOZA+1uQmAF12G4ZkBVL/kXDk= Received: by 10.14.47.193 with SMTP id t41mr2597948eeb.21.1295258929065; Mon, 17 Jan 2011 02:08:49 -0800 (PST) Received: from localhost (ppp85-140-161-155.pppoe.mtu-net.ru [85.140.161.155]) by mx.google.com with ESMTPS id t5sm3470933eeh.14.2011.01.17.02.08.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 17 Jan 2011 02:08:48 -0800 (PST) From: Vasiliy Kulikov To: kernel-janitors@vger.kernel.org Cc: Jiri Kosina , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] hid: hid-roccat-koneplus: potential NULL dereference Date: Mon, 17 Jan 2011 13:08:45 +0300 Message-Id: <1295258925-31288-1-git-send-email-segoon@openwall.com> X-Mailer: git-send-email 1.7.0.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 17 Jan 2011 10:09:41 +0000 (UTC) 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);