From patchwork Fri Sep 22 21:29:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 114102 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3756274qgf; Fri, 22 Sep 2017 14:31:14 -0700 (PDT) X-Google-Smtp-Source: AOwi7QA0OfV48bJ5VDzCljf6AIH+oLQSzeJcna/qDFxcPZDx1yt3vHEK1w+ez3TsphcR+Py44mjS X-Received: by 10.99.124.87 with SMTP id l23mr376016pgn.351.1506115874386; Fri, 22 Sep 2017 14:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506115874; cv=none; d=google.com; s=arc-20160816; b=UpJ9aN3rmGv6DzUyEtwaYKGszV+8iz9mzZrfyXzJiZojXppOKk1GUohjnu2JWogwSv tN9TDkKYUFyib1JIvOo/nnFxOtiiKopB0GuZI/TmXj6vBFJH8mPlHIGO9Wk0bPxPK9/l cn2QsOdzliniAU4S+CwciiNk+MTIgQ4SxK1Z5ZMq8tLnJu6mRAcb+SiiIEqeMeI7arpZ kjQpxnwX9t8855weQkCRsk6yukTMSn/MqMSW0aeeWkWIC/A1F1vGg62IOlExEf1XRHy6 eZDTqkQTe4TV5J2Ipo1YCpYKMU1Mz9UZ4dKmBFWfSDFDVYmkMyMHQCjkrmmhf4wzelvY VXeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=w2axbrVFRIuPdSh6Hse1JVaAcNjqQWsdy8VQ/7kxWFs=; b=RiBuccAmBS8t0P1eOfHUZNCpkAv6PMUPXXPiryWoypbKko5qbk2Sxri4lF4jOhy9Hl iGXYQHMRF+uIJVslHXfBcs0bsySZFII/HoOuaeHIwxRiiKsfTaUNLc+S5PRXm2A/kcOj 4kuGOG4HVVIlJW+IasmQ4s2QXeeFa3WTE4ISugeE68jGPDxMwnLazB1kHCV8aDhCnfpt d6XY54/hj9PTyj6+xWlH4YPphI4QhDutEKkH3yymLkbfelaP6m0ObwfDMkp3/lKMB+FR l/6NQkSdCD7zhvQHgaWrRzga0cuv9NtbtZTlZHtFm9U/p9kVVBb9CQBZyNuGbN5bHaja OjKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v35si400623pgn.367.2017.09.22.14.31.13; Fri, 22 Sep 2017 14:31:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752701AbdIVVbL (ORCPT + 8 others); Fri, 22 Sep 2017 17:31:11 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:62236 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752554AbdIVVbH (ORCPT ); Fri, 22 Sep 2017 17:31:07 -0400 Received: from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0LvN23-1dDklQ1MEl-010gHN; Fri, 22 Sep 2017 23:30:39 +0200 From: Arnd Bergmann To: Mauro Carvalho Chehab Cc: Arnd Bergmann , Jiri Pirko , Arend van Spriel , Kalle Valo , "David S. Miller" , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Masahiro Yamada , Michal Marek , Andrew Morton , Kees Cook , Geert Uytterhoeven , Greg Kroah-Hartman , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, kasan-dev@googlegroups.com, linux-kbuild@vger.kernel.org, Jakub Jelinek , =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH v4 5/9] r820t: fix r820t_write_reg for KASAN Date: Fri, 22 Sep 2017 23:29:16 +0200 Message-Id: <20170922212930.620249-6-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170922212930.620249-1-arnd@arndb.de> References: <20170922212930.620249-1-arnd@arndb.de> X-Provags-ID: V03:K0:5UIKjDdx5TPWijAblgwl7fPHNso5cdYP6yvfBUx1aQikrLUEBtt 3JmR6vce6Q/n1qhb+YBZTIXhRk5nRCXm3fSGYj0APAh6OwzjkyZS7S26iyhfOu87R01g8cy Gs13V9lB68QQTivOr71Mp2TYHG+rIgzvCrsmrX82bEKf7UlDI3N0GVEM+XvCuvNPKZldWXA 5u5sYfgDkub4gpPBPxTHQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:pizOdsbHG8E=:w78jKMm6ZA8OuepjiBPngf FKd2F13xMVq4oCHcSvLbZAGbob+tHyPBB/ODXsXJ3nyl0AIIE/OQCfIzzn8TzgKxjYByu8AkT KfxyuFq/isash9U8KaacLU42uuidUWwLixcMxzEsFXjNGvZqBqqUM9IVJnbqiVlbce0qwQOGY fzsvoGpcyuri8zSDq2Ofw74UDxIE45tnBhyJXX89uwjtxVjOBX9N/bIlOurqA1ZfvoENdbTev Fm8yGqwwjbtPjNIMbH9Sx9WMmMTrLVJaDaAv7Puv+mOyBdTSzyv7/C8pf2yJwpU7fqRnINg+o go0OIQ4sQVoFQ0YB7/1jNXuHb50ZlQPmSb0HQXdTF9hblifbJQJ6j96AwpRRLUvmt/0EDsPZW wjU3FGxt6YnoJprccDoSQnfZsyo5z2FY8eVAM2Di4wmR5BB1XlydIQtN3b708YJ8XZDxUy67D CkBkVFI448EIkA1M0v+rIaK5Rk4YtWdvObKd9fzaJLBWmAd/h8MWjKZcYsKSEEV9vo2c78zqe LaUIeX+mOGfIrfhHeKG3aAnu50r3HXIXFKY/H7So4ZdVm2cunI1dYEsnLn8vHH6QGtLq7OvgI u5qZmMuDFme6bhF1YbnvXroYJsUkBXOjfKXLnPazzZ/oqkn8vn2Anc8qR7zNNfTIfadHpbKPN DpUppigC6F0Hry+SI/0wqkSFE0iSKqiS1pOormKAvfdD7/ILlMOYgtFuo1aBsXkLZqczFiXU7 QyWPV3FHRDNkSXEILbXwPnJ62GY/UzSgwqn/Jw== Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org With CONFIG_KASAN, we get an overly long stack frame due to inlining the register access functions: drivers/media/tuners/r820t.c: In function 'generic_set_freq.isra.7': drivers/media/tuners/r820t.c:1334:1: error: the frame size of 2880 bytes is larger than 2048 bytes [-Werror=frame-larger-than=] This is caused by a gcc bug that has now been fixed in gcc-8. To work around the problem, we can pass the register data through a local variable that older gcc versions can optimize out as well. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 Signed-off-by: Arnd Bergmann --- drivers/media/tuners/r820t.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- 2.9.0 diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c index ba80376a3b86..d097eb04a0e9 100644 --- a/drivers/media/tuners/r820t.c +++ b/drivers/media/tuners/r820t.c @@ -396,9 +396,11 @@ static int r820t_write(struct r820t_priv *priv, u8 reg, const u8 *val, return 0; } -static int r820t_write_reg(struct r820t_priv *priv, u8 reg, u8 val) +static inline int r820t_write_reg(struct r820t_priv *priv, u8 reg, u8 val) { - return r820t_write(priv, reg, &val, 1); + u8 tmp = val; /* work around GCC PR81715 with asan-stack=1 */ + + return r820t_write(priv, reg, &tmp, 1); } static int r820t_read_cache_reg(struct r820t_priv *priv, int reg) @@ -411,17 +413,18 @@ static int r820t_read_cache_reg(struct r820t_priv *priv, int reg) return -EINVAL; } -static int r820t_write_reg_mask(struct r820t_priv *priv, u8 reg, u8 val, +static inline int r820t_write_reg_mask(struct r820t_priv *priv, u8 reg, u8 val, u8 bit_mask) { + u8 tmp = val; int rc = r820t_read_cache_reg(priv, reg); if (rc < 0) return rc; - val = (rc & ~bit_mask) | (val & bit_mask); + tmp = (rc & ~bit_mask) | (tmp & bit_mask); - return r820t_write(priv, reg, &val, 1); + return r820t_write(priv, reg, &tmp, 1); } static int r820t_read(struct r820t_priv *priv, u8 reg, u8 *val, int len)