From patchwork Thu Mar 2 16:38:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9601039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A7AAA60453 for ; Thu, 2 Mar 2017 17:12:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8D6827D8D for ; Thu, 2 Mar 2017 17:12:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA52D27F94; Thu, 2 Mar 2017 17:12:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB3E427D8D for ; Thu, 2 Mar 2017 17:12:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754425AbdCBRLg (ORCPT ); Thu, 2 Mar 2017 12:11:36 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:58845 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752664AbdCBRLQ (ORCPT ); Thu, 2 Mar 2017 12:11:16 -0500 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MIUYB-1cjCMr1kDv-00486U; Thu, 02 Mar 2017 17:38:54 +0100 From: Arnd Bergmann To: kasan-dev@googlegroups.com Cc: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-wireless@vger.kernel.org, kernel-build-reports@lists.linaro.org, "David S . Miller" , Arnd Bergmann Subject: [PATCH 15/26] [media] tuners: i2c: reduce stack usage for tuner_i2c_xfer_* Date: Thu, 2 Mar 2017 17:38:23 +0100 Message-Id: <20170302163834.2273519-16-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170302163834.2273519-1-arnd@arndb.de> References: <20170302163834.2273519-1-arnd@arndb.de> X-Provags-ID: V03:K0:Ptxhg5ILTKDXfqKilzQqG9mrVtGHkl5fqgmNl5/wJAPj/q26fOH DtIu3XQb476m0wBLeHq5W58TIHk3KV5nunVLTL07CjjbCobzN8dVzSE/G9Ocy40ch33ZN3d 3icVYBTTVmX50fgp4V5SSSTp8LZYwyQ12qPlpOpX5064Nsl0JJ9IkX3Wl7GIvGCXKqVm97v IPBbdiim/UdQ2zOpUf5bg== X-UI-Out-Filterresults: notjunk:1; V01:K0:GFfo8dSd8ws=:KrgfxKM1lp+cKXypU6kZb7 K8/H4OglH1HGKjlKpAa2P8T/FWxDZZPISHALwMAJNkL0vu3f7ks8lf7W/RwB1N23NNtLnIU4n 2FEfrlOMFO+fKnV5Ph0Qeb19RYjqE/lHnwIrWmBwAMTrZpX+foL8fBNTCgP1kVsXp/kzd4vQ2 TafXeF8sdd7akfcP+pk+C2G9r2SqBWLsXYv/LCqt5yYSNHfE43ttfEmBbYsOwzmBwvtcFVkdl 6nhoi1RZKz97D90FhLGQunfey8fEw4iV00QSqXpCCnv+QZQiMA4cqPdumfULSh/2fZTkRivCe +qBERgZmtWkSUnbwvQVct1W4vSIWWE11peUPeNZeLo3jg5PQImZMXwbfV30HWrS8SWxUP3f62 JpNwpnnBsnM7mQmNnwUz7N4jgpXEdctCPqdx0R98HWr3Ez+Xj5ya8oQEKuGatgJMCJD7TIy4F dcBMFensnEgjjzNt7T2CiF5YevTryxSbnUSvXgV/+DSyzJwq3/PhQmUoNN9Cxgo5702/Ho89O Dq0HyxBtnAyG1WMQUOseAP7MuY2KtAKw9k2HxR3+HkBI1W7/vHfQpDkBo/9/axJhGMAksvVza 5abyNCbaI7mq+IgsYikv5YLnxp0wmURtKIHwMbuZPhlgnSWDdtlNHeWMKUZCfJfOLcPXfqeNA WD4vPNyxDTYOc6rvXEDUg0YOGoTWpOcZ/JhSWINetzRbSExGg5fTpvRWdgIdied3j74w= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When CONFIG_KASAN is enabled, we see very large stack usage in some functions, e.g.: drivers/media/tuners/tda8290.c: In function 'tda8290_set_params': drivers/media/tuners/tda8290.c:310:1: warning: the frame size of 3184 bytes is larger than 1024 bytes [-Wframe-larger-than=] drivers/media/tuners/tda8290.c: In function 'tda829x_probe': drivers/media/tuners/tda8290.c:878:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=] By annotating the helpers as noinline_for_kasan, we can easily avoid this. Signed-off-by: Arnd Bergmann --- drivers/media/tuners/tuner-i2c.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/media/tuners/tuner-i2c.h b/drivers/media/tuners/tuner-i2c.h index bda67a5a76f2..c8970299799c 100644 --- a/drivers/media/tuners/tuner-i2c.h +++ b/drivers/media/tuners/tuner-i2c.h @@ -33,8 +33,8 @@ struct tuner_i2c_props { char *name; }; -static inline int tuner_i2c_xfer_send(struct tuner_i2c_props *props, - unsigned char *buf, int len) +static noinline_for_kasan int +tuner_i2c_xfer_send(struct tuner_i2c_props *props, unsigned char *buf, int len) { struct i2c_msg msg = { .addr = props->addr, .flags = 0, .buf = buf, .len = len }; @@ -43,8 +43,8 @@ static inline int tuner_i2c_xfer_send(struct tuner_i2c_props *props, return (ret == 1) ? len : ret; } -static inline int tuner_i2c_xfer_recv(struct tuner_i2c_props *props, - unsigned char *buf, int len) +static noinline_for_kasan int +tuner_i2c_xfer_recv(struct tuner_i2c_props *props, unsigned char *buf, int len) { struct i2c_msg msg = { .addr = props->addr, .flags = I2C_M_RD, .buf = buf, .len = len }; @@ -53,9 +53,10 @@ static inline int tuner_i2c_xfer_recv(struct tuner_i2c_props *props, return (ret == 1) ? len : ret; } -static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props, - unsigned char *obuf, int olen, - unsigned char *ibuf, int ilen) +static noinline_for_kasan int +tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props, + unsigned char *obuf, int olen, + unsigned char *ibuf, int ilen) { struct i2c_msg msg[2] = { { .addr = props->addr, .flags = 0, .buf = obuf, .len = olen },