From patchwork Mon Jan 24 18:32:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 501631 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 p0OJh2ZD026265 for ; Mon, 24 Jan 2011 19:48:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753477Ab1AXSc3 (ORCPT ); Mon, 24 Jan 2011 13:32:29 -0500 Received: from mail-ww0-f44.google.com ([74.125.82.44]:48255 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752948Ab1AXSc2 (ORCPT ); Mon, 24 Jan 2011 13:32:28 -0500 Received: by wwa36 with SMTP id 36so4604843wwa.1 for ; Mon, 24 Jan 2011 10:32:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=PN5XsEJ3i4UWhaM50XlgYGnRmCpNtIzMxeJVGJChBOE=; b=v4AKe/nxbKdI4kU2NtGbvxV/fUWO5D753DIArLqE4bfgVg6Vs6sxiIxJy6Nn4HyF4a HqZTv/iBLg8gOPAAIA0adGeoVbiSgbwvg/SSyEBesCnztCsZa0rqHS3SZKcophNqPK2M +JwqRf08+ETlpPfPUK3ljeZtgz3cKhaNCvVWE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=imrmctVUjKzDsewgZO5J6NCsXV8aDSylx1da/t2+1nv9YHLinrak46UkzNRuYdfBTy eC9Y2WC+Puoc4hZiqvFmco6l8P9eBZdvwrsB2+5brvNUbHmqZxJnEwkrZmclwgmk05G2 LvNwQVG5OnEjWsuZ7CQKozCaDXSQXPneWiXmg= Received: by 10.227.177.10 with SMTP id bg10mr4757613wbb.148.1295893946122; Mon, 24 Jan 2011 10:32:26 -0800 (PST) Received: from bicker ([41.202.225.146]) by mx.google.com with ESMTPS id m13sm9479671wbz.21.2011.01.24.10.32.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 24 Jan 2011 10:32:24 -0800 (PST) Date: Mon, 24 Jan 2011 21:32:13 +0300 From: Dan Carpenter To: Jiri Kosina , erazor_de@users.sourceforge.net Cc: linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] hid: check for kmalloc() failure Message-ID: <20110124183213.GA2721@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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, 24 Jan 2011 19:48:19 +0000 (UTC) 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));