From patchwork Wed Jan 19 12:57:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasiliy Kulikov X-Patchwork-Id: 489201 X-Patchwork-Delegate: khilman@deeprootsystems.com 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 p0JEuJBS010815 for ; Wed, 19 Jan 2011 15:20:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753169Ab1ASM5b (ORCPT ); Wed, 19 Jan 2011 07:57:31 -0500 Received: from mail-ew0-f46.google.com ([209.85.215.46]:60041 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753014Ab1ASM5a (ORCPT ); Wed, 19 Jan 2011 07:57:30 -0500 Received: by ewy5 with SMTP id 5so355822ewy.19 for ; Wed, 19 Jan 2011 04:57:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=VVjb83xQt7xL/wapxOATdc3Iqde2ucsAEBJHlGv+Mxc=; b=ae8nZtXE8vh/0QFpQKlR6Q9sv6Knio9yUgh4BvmQdl6L4AITSBiMcdNyrEXuPzIapc mZShsr3eIVa/pzPoqiBtDcPUSvz1uGWd998ayxZPnjLRfqqQZOKZwkwZOsn9ZW8lEdQF lt/BQ8BJJ2mJhv5KOoVCmyPt2nHz2e02Lcpsw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=A6piG0cjF6G4MS2wcIbjrmKxkEY0RsFp8GRnEMkz41Hh4ooPuZhs0x9hTStmF8qgd+ XGQM5ALXb20mFHdFVrhz4Pc3Ocd0xaGi9cEHfdutfeLfNfoVa0x570JtMPC4mC4j3J2S hyKUaAPhe/hK881Jl5EwywcwOHFXSpJr0zDkQ= Received: by 10.213.19.20 with SMTP id y20mr939018eba.75.1295441846881; Wed, 19 Jan 2011 04:57:26 -0800 (PST) Received: from localhost (ppp91-77-43-125.pppoe.mtu-net.ru [91.77.43.125]) by mx.google.com with ESMTPS id u1sm5514560eeh.22.2011.01.19.04.57.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 19 Jan 2011 04:57:25 -0800 (PST) Date: Wed, 19 Jan 2011 15:57:22 +0300 From: Vasiliy Kulikov To: linux-kernel@vger.kernel.org Cc: walter harms , kernel-janitors@vger.kernel.org, Tony Lindgren , Russell King , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] arm: mach-omap2: potential NULL dereference Message-ID: <20110119125721.GA9203@albatros> References: <1295258922-31242-1-git-send-email-segoon@openwall.com> <4D341C35.80506@bfs.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4D341C35.80506@bfs.de> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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]); Wed, 19 Jan 2011 15:20:31 +0000 (UTC) diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index 77ecebf..697d8d4 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c @@ -260,9 +260,11 @@ static int sr_late_init(struct omap_sr *sr_info) if (sr_class->class_type == SR_CLASS2 && sr_class->notify_flags && sr_info->irq) { - name = kzalloc(SMARTREFLEX_NAME_LEN + 1, GFP_KERNEL); - strcpy(name, "sr_"); - strcat(name, sr_info->voltdm->name); + name = kasprintf(GFP_KERNEL, "sr_%s", sr_info->voltdm->name); + if (name == NULL) { + ret = -ENOMEM; + goto error; + } ret = request_irq(sr_info->irq, sr_interrupt, 0, name, (void *)sr_info); if (ret)