Received: by 10.223.185.116 with SMTP id b49csp940063wrg; Wed, 21 Feb 2018 09:20:55 -0800 (PST) X-Google-Smtp-Source: AH8x224+B+hfFAv3gz0yDW2wvaZLLm8/zKiiFHvkDBzOWZ5oGqwAThz86qGEoCb/I785AGhN3/XW X-Received: by 2002:a17:902:8498:: with SMTP id c24-v6mr3759825plo.450.1519233655371; Wed, 21 Feb 2018 09:20:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519233655; cv=none; d=google.com; s=arc-20160816; b=fpLzDGcB6954LjFjuf0DRIz8S/Nz4jbfQTjNRruO/f6EK0e6R9JI5kmDUERuZ+k8OO cK6grcpW5OhBiLorjnBDQilk1JEeekzEpWkZU5+BuuJuqqI0Pfx2o1Litq8fDUjQKirf 20pC7VNMTHJVVRzrMgK5+z0tSsftai8VtydvFLB8lzSAN+WpV50Lh/uGlrrnIkWwtVTZ aH0AO4tHPIYjAxmviAN5bQ+28QsDxjhbiP+rPte4vTyGkWUEULE8aBl2VBD5bc9VxjmE N0Ipd1fjKN0WawjLffNf6KkKkJMnLCUYKqg8OZlqzlKD82oaMAv3xM+4qAUETmZPq40U ojWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=6szMVwqh4/mDvg6vizrdByo8Nnd5YTsldoi4JDmWIqI=; b=FkAOEgREhjKx+JsH0vX/57//D1OLZoECJyOFc+ch3jWYbHMYDVEAaRBWLgb3LMToYC /JMvhp7Lfdw6daj6QH2THtgHiRIsiqEW4KiF6W+YcXSS6buCUJJS5a1zbMJX6SOOL0gZ zYk+oozQ/if9VmN5qlnJ8/puApXxegyAgDE2vsLR2S0bI91c7x1Ya127Vt/C9qiN6gNj BYJN9dhj4umcvMFTaCzP4pz24Nw1o5cSoDUTJCcCrbwrPI/aI62ZfHPKg4J/lQsBv2Y6 ks8Cr9d6HR4pZMwKah1u8K3koSXbPK03SAR2R48POv0jW3/OAiNjMR3YNPzOTdzpMyqd MOBw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1-v6si6785263plm.399.2018.02.21.09.20.41; Wed, 21 Feb 2018 09:20:55 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934680AbeBUM53 (ORCPT + 99 others); Wed, 21 Feb 2018 07:57:29 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35762 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934650AbeBUM50 (ORCPT ); Wed, 21 Feb 2018 07:57:26 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id ABB3BC14; Wed, 21 Feb 2018 12:57:25 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Mauro Carvalho Chehab Subject: [PATCH 4.9 75/77] media: r820t: fix r820t_write_reg for KASAN Date: Wed, 21 Feb 2018 13:49:24 +0100 Message-Id: <20180221124435.339734334@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124432.172390020@linuxfoundation.org> References: <20180221124432.172390020@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit 16c3ada89cff9a8c2a0eea34ffa1aa20af3f6008 upstream. 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 Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/tuners/r820t.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) --- a/drivers/media/tuners/r820t.c +++ b/drivers/media/tuners/r820t.c @@ -396,9 +396,11 @@ static int r820t_write(struct r820t_priv 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 r 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)