From patchwork Thu Jun 6 01:22:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kim Kukjin X-Patchwork-Id: 2676651 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id BFED93FD4F for ; Thu, 6 Jun 2013 01:22:39 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UkOuQ-0006MI-Ni; Thu, 06 Jun 2013 01:22:35 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UkOuN-0003Ha-Tk; Thu, 06 Jun 2013 01:22:31 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UkOuJ-0003HE-DI for linux-arm-kernel@lists.infradead.org; Thu, 06 Jun 2013 01:22:29 +0000 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MNY00F306GSXC90@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 06 Jun 2013 10:22:04 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.49]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 0D.54.11618.C34EFA15; Thu, 06 Jun 2013 10:22:04 +0900 (KST) X-AuditID: cbfee691-b7fef6d000002d62-79-51afe43c3c4c Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id FA.F4.28381.B34EFA15; Thu, 06 Jun 2013 10:22:04 +0900 (KST) Received: from DOKGENEKIM03 ([12.23.120.199]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MNY00FOH6GR9360@mmp2.samsung.com>; Thu, 06 Jun 2013 10:22:03 +0900 (KST) From: Kukjin Kim To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] pinctrl: exynos5440: fix issues reported by prevent tool Date: Thu, 06 Jun 2013 10:22:03 +0900 Message-id: <09d101ce6254$40813eb0$c183bc10$%kim@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac5iVEBtmxe+yMBxR2qrahzPNID4cg== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsVy+t8zQ12bJ+sDDeZt4rSY8mc5k8Wmx9dY LWac38dk0bGM0YHF4861PWwem5fUe/RtWcXo8XmTXABLFJdNSmpOZllqkb5dAldG06HrzAWz RSt6dl9ga2BcJ9jFyMkhIWAi8aTxFiuELSZx4d56ti5GLg4hgWWMEvOmP2aBKXqx+xMjRGI6 o8Sx1ztYIZy/QM7THewgVWwCGhKH3z8Dsjk4RAS8JZZfUwQJMwtESWxZcJsJxBYW8JS4ePMo K0gJi4CqxMQWcxCTV8BW4uYLfZAKXgFBiR+T77FAdGpJrN95nAnClpfYvOYtM0i5hIC6xKO/ uiBhEQE9iSu3n7FDlIhI7HvxDuxKCYFN7BKbrvxhBkmwCAhIfJt8iAWiV1Zi0wFmiK8kJQ6u uMEygVFsFpLNs5BsnoVk8ywkKxYwsqxiFE0tSC4oTkovMtUrTswtLs1L10vOz93ECImuiTsY 7x+wPsSYDLR+IrOUaHI+MDrzSuINjc2MLExNTI2NzC3NSBNWEudVb7EOFBJITyxJzU5NLUgt ii8qzUktPsTIxMEp1cBo2+yWVO53n+foyWn7g+sK8r/Gxd7cfXZ2gVw0Q157jD3Lrc3bRUQ4 9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000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130605_212227_684922_BAFA61DE X-CRM114-Status: GOOD ( 10.85 ) X-Spam-Score: -7.4 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.25 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 T_HDRS_LCASE Odd capitalization of message header 0.0 T_MANY_HDRS_LCASE Odd capitalization of multiple message headers Cc: 'Linus Walleij' , 'Thomas Abraham' X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Thomas Abraham This patch fixes issues reported by prevent tool. Signed-off-by: Thomas Abraham Signed-off-by: Kukjin Kim --- drivers/pinctrl/pinctrl-exynos5440.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/pinctrl-exynos5440.c b/drivers/pinctrl/pinctrl-exynos5440.c index 6436a02..063be17 100644 --- a/drivers/pinctrl/pinctrl-exynos5440.c +++ b/drivers/pinctrl/pinctrl-exynos5440.c @@ -220,7 +220,7 @@ static int exynos5440_dt_node_to_map(struct pinctrl_dev *pctldev, dev_err(dev, "failed to alloc memory for group name\n"); goto free_map; } - sprintf(gname, "%s%s", np->name, GROUP_SUFFIX); + snprintf(gname, strlen(np->name) + 4, "%s%s", np->name, GROUP_SUFFIX); /* * don't have config options? then skip over to creating function @@ -259,7 +259,8 @@ skip_cfgs: dev_err(dev, "failed to alloc memory for func name\n"); goto free_cfg; } - sprintf(fname, "%s%s", np->name, FUNCTION_SUFFIX); + snprintf(fname, strlen(np->name) + 4, "%s%s", np->name, + FUNCTION_SUFFIX); map[*nmaps].data.mux.group = gname; map[*nmaps].data.mux.function = fname; @@ -713,7 +714,8 @@ static int exynos5440_pinctrl_parse_dt(struct platform_device *pdev, dev_err(dev, "failed to alloc memory for group name\n"); return -ENOMEM; } - sprintf(gname, "%s%s", cfg_np->name, GROUP_SUFFIX); + snprintf(gname, strlen(cfg_np->name) + 4, "%s%s", cfg_np->name, + GROUP_SUFFIX); grp->name = gname; grp->pins = pin_list; @@ -733,7 +735,8 @@ skip_to_pin_function: dev_err(dev, "failed to alloc memory for func name\n"); return -ENOMEM; } - sprintf(fname, "%s%s", cfg_np->name, FUNCTION_SUFFIX); + snprintf(fname, strlen(cfg_np->name) + 4, "%s%s", cfg_np->name, + FUNCTION_SUFFIX); func->name = fname; func->groups = devm_kzalloc(dev, sizeof(char *), GFP_KERNEL); @@ -806,7 +809,7 @@ static int exynos5440_pinctrl_register(struct platform_device *pdev, /* for each pin, set the name of the pin */ for (pin = 0; pin < ctrldesc->npins; pin++) { - sprintf(pin_names, "gpio%02d", pin); + snprintf(pin_names, 6, "gpio%02d", pin); pdesc = pindesc + pin; pdesc->name = pin_names; pin_names += PIN_NAME_LENGTH; @@ -993,7 +996,7 @@ static int exynos5440_pinctrl_probe(struct platform_device *pdev) return -ENODEV; } - priv = devm_kzalloc(dev, sizeof(priv), GFP_KERNEL); + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) { dev_err(dev, "could not allocate memory for private data\n"); return -ENOMEM;