From patchwork Mon Nov 11 06:05:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 179053 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6211386ilf; Sun, 10 Nov 2019 22:00:30 -0800 (PST) X-Google-Smtp-Source: APXvYqxRMHyy4R49W7x0x1Wq0+eT0fvB6gpfiIO06TkkluYJXDSpzufUl0VRV4f5kZ6ZJzI3Yjkr X-Received: by 2002:a17:906:c2d6:: with SMTP id ch22mr425137ejb.262.1573452030199; Sun, 10 Nov 2019 22:00:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573452030; cv=none; d=google.com; s=arc-20160816; b=fuU39OZ1vIge+0fHAGd1sjfdSE3zzgdqSQSwogGbypsiY4IrKRM9TGEh9L3j03ohrg /Z9hjetJLpW7I9jmvUUEmNaTKNBxEzUGNFEZe42S4TOudD+kxBMqWoeJ9aYJWVWesQBp plvzmIs+uLdCLKIefHNLA8V0o7OpXryl0EOmt+HmbywWcAQ+nfinNJzwBb+NoN0FCpeT RBL6uFUc7KDKTorWIsyZetOlwdRTbhdM42ZNXNF3uUu+NFHNblcWjAtawJ3CASAu4AGt O9ABaLOB62wAPOk1kuqNsWkf/CWkol/bzjb6u/CQmgiTETQJ3N3RJ8bc36Ljx2MkoKcU D50Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=ZHmtJwzZPCJJj1Yw3R6N0QRExV0RN+KRydhi5ot94GM=; b=s4zS5+4jXFHaFUc2pnjrdA3Cpis+aA9tRyQRDAAeknkkuIT5iK/JS6tx3/0msmEF8t f8TCKP1oiL70rUNYOMivIN9aYxmZG3KW1NNrPZmHBnnN3Yh+uvP5w5bVhhgD2DNhkbDK gwPTfa5HfHIsktzXjjmtgUhjuO+tkKBu5q2Y9jAELW8ftxbcHCKJzlfHWalRngJla6ME YmxS1wwQVLBAANLlAbjvY2ibTrSNikyJ5D5nWk/eQmtxopnGtX7sxRn3GwPV8buDIVwD cY1hGyLjPuGy05/Fn2bc+7CpbK7xvd5D02lyT3L6yuLwFQcuuAf+dcmeCeE9jqruoIya 5DFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=bk8oXaTf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w8si9122707ejq.57.2019.11.10.22.00.29; Sun, 10 Nov 2019 22:00:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=bk8oXaTf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726985AbfKKGAZ (ORCPT + 26 others); Mon, 11 Nov 2019 01:00:25 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:35915 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726205AbfKKGAY (ORCPT ); Mon, 11 Nov 2019 01:00:24 -0500 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20191111060022epoutp029167a3dfc786bdacb6de2d541aa981b2~WBkcWGNzz0691806918epoutp02c for ; Mon, 11 Nov 2019 06:00:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20191111060022epoutp029167a3dfc786bdacb6de2d541aa981b2~WBkcWGNzz0691806918epoutp02c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1573452022; bh=ZHmtJwzZPCJJj1Yw3R6N0QRExV0RN+KRydhi5ot94GM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bk8oXaTfsiIJMjoHYWHvtvzcnjNC0GKZmhxl7gQd/EfhAgvrfZQpcvgScmVHEGzhl UReOOBZgcDS2pW1CHuRs1lzrgag2WbuZnkd/zndqUWP5XBq+FmjfQIChPzfigXsrTm 79JALZOiFXOG5bAZVmBuOhNu590b9wtGwnLSXffo= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20191111060020epcas1p4c921ab5b85780714865dc23a2d8cbf55~WBkbMqGZl0767907679epcas1p4R; Mon, 11 Nov 2019 06:00:20 +0000 (GMT) Received: from epsmges1p4.samsung.com (unknown [182.195.40.154]) by epsnrtp1.localdomain (Postfix) with ESMTP id 47BKwd6CVkzMqYlm; Mon, 11 Nov 2019 06:00:17 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p4.samsung.com (Symantec Messaging Gateway) with SMTP id 7F.37.04224.1F8F8CD5; Mon, 11 Nov 2019 15:00:17 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20191111060017epcas1p37c624e81f5421842a5a31136b4cba678~WBkXxeQtG0355803558epcas1p3a; Mon, 11 Nov 2019 06:00:17 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20191111060017epsmtrp2d85c01a94bfe0ccb9a36df6668aca5be~WBkXwwuFV3261032610epsmtrp2A; Mon, 11 Nov 2019 06:00:17 +0000 (GMT) X-AuditID: b6c32a38-d43ff70000001080-3f-5dc8f8f17596 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 26.F3.24756.1F8F8CD5; Mon, 11 Nov 2019 15:00:17 +0900 (KST) Received: from localhost.localdomain (unknown [10.113.221.102]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191111060017epsmtip2d361588ef8e0bde92397ce4fdeb16f63~WBkXiuppH3118631186epsmtip2Z; Mon, 11 Nov 2019 06:00:17 +0000 (GMT) From: Chanwoo Choi To: arnd@arndb.de, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, krzk@kernel.org, kgene@kernel.org Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, chanwoo@kernel.org, Chanwoo Choi Subject: [PATCH v2] PM / devfreq: events: Fix excessive stack usage Date: Mon, 11 Nov 2019 15:05:57 +0900 Message-Id: <20191111060557.15650-1-cw00.choi@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022142703.1789898-1-arnd@arndb.de> X-Brightmail-Tracker: H4sIAAAAAAAAA02SbUhTYRTHeXZ3767V5DZXnfxQdsUPCuquc3mt2ZsRo4SM6Esk66YXJ+6t 3a20AnsjzXSlidiLEWlZRjTWGBq+K6aWGpkWmBRaWVZGLXsv27xGffufw+///A/nOSSm+I2H kllmO28zc0aamCP1tkeqoj987UpT1U/Fsb9KO2VsyeOHUvbRp3GcPTn2BmP7+10ytvfwWxnr HhvC2YHb5wnWV9yB2Ir+Jgk7fOgqsWau7sf3UqRz1x4ndLeq83ROTy3S+dxLUvHt2VoDz2Xw tjDenG7JyDJnJtGbtuqT9ZrlKiaaSWQT6DAzZ+KT6PUpqdEbsoz+yeiwPZzR4W+lcoJAx67S 2iwOO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KvP92gRkkISzgLPH85zOwBhYBVYm3c2ewg9i8 AlYSr56vYoZYJi+xesMBMJtTwFRiee9jsCOEgK7rWfeJcQIj3wJGhlWMkqkFxbnpucWGBYZ5 qeV6xYm5xaV56XrJ+bmbGMHBqaW5g/HykvhDjAIcjEo8vD90TsQKsSaWFVfmHmKU4GBWEuHd UQEU4k1JrKxKLcqPLyrNSS0+xCjNwaIkzvs071ikkEB6YklqdmpqQWoRTJaJg1OqgbE05FiR UO7GzyVP1A2OXK5Y4r/ng/bNAk8h9a1hv2a3n7YPeLfo05vOl51iT7WLJ9o11h6xs2iR33Vu tnhwSxObVvFpXjUOuZzLIizSD4zSjiYI3/Bjl17t9OZmkE54/DUX/kPPor7MNF7CK/l086/d Vuk2T1JrF+5SM7kmxqv+NunDgb2fFyixFGckGmoxFxUnAgCftVZuSgIAAA== X-CMS-MailID: 20191111060017epcas1p37c624e81f5421842a5a31136b4cba678 X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20191111060017epcas1p37c624e81f5421842a5a31136b4cba678 References: <20191022142703.1789898-1-arnd@arndb.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Putting a 'struct devfreq_event_dev' object on the stack is generally a bad idea and here it leads to a warnig about potential stack overflow: drivers/devfreq/event/exynos-ppmu.c:643:12: error: stack frame size of 1040 bytes in function 'exynos_ppmu_probe' [-Werror,-Wframe-larger-than=] There is no real need for the device structure, only the string inside it, so add an internal helper function that simply takes the string as its argument and remove the device structure. Fixes: 1dd62c66d345 ("PM / devfreq: events: extend events by type of counted data") Signed-off-by: Arnd Bergmann [cw00.choi: Fix the issue from 'desc->name' to 'desc[j].name'] Signed-off-by: Chanwoo Choi --- Changes from v1: - Fix the issue from 'desc->name' to 'desc[j].name' drivers/devfreq/event/exynos-ppmu.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c index 85c7a77bf3f0..055deea42c37 100644 --- a/drivers/devfreq/event/exynos-ppmu.c +++ b/drivers/devfreq/event/exynos-ppmu.c @@ -101,17 +101,22 @@ static struct __exynos_ppmu_events { PPMU_EVENT(dmc1_1), }; -static int exynos_ppmu_find_ppmu_id(struct devfreq_event_dev *edev) +static int __exynos_ppmu_find_ppmu_id(const char *edev_name) { int i; for (i = 0; i < ARRAY_SIZE(ppmu_events); i++) - if (!strcmp(edev->desc->name, ppmu_events[i].name)) + if (!strcmp(edev_name, ppmu_events[i].name)) return ppmu_events[i].id; return -EINVAL; } +static int exynos_ppmu_find_ppmu_id(struct devfreq_event_dev *edev) +{ + return __exynos_ppmu_find_ppmu_id(edev->desc->name); +} + /* * The devfreq-event ops structure for PPMU v1.1 */ @@ -556,13 +561,11 @@ static int of_get_devfreq_events(struct device_node *np, * use default if not. */ if (info->ppmu_type == EXYNOS_TYPE_PPMU_V2) { - struct devfreq_event_dev edev; int id; /* Not all registers take the same value for * read+write data count. */ - edev.desc = &desc[j]; - id = exynos_ppmu_find_ppmu_id(&edev); + id = __exynos_ppmu_find_ppmu_id(desc[j].name); switch (id) { case PPMU_PMNCNT0: