Received: by 10.223.185.116 with SMTP id b49csp1019058wrg; Wed, 21 Feb 2018 10:39:56 -0800 (PST) X-Google-Smtp-Source: AH8x224pePukPR30K/UxBMyY7MrcCgN9x26Q/RYStt8UgqTwVnjBVF/wWkeoGxzmA0qT/H1MLris X-Received: by 2002:a17:902:2b84:: with SMTP id l4-v6mr4013520plb.338.1519238396319; Wed, 21 Feb 2018 10:39:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238396; cv=none; d=google.com; s=arc-20160816; b=p+zQkAQfnHYdthP9aWN0SRZLEyADWZq00Aw8CMroZwmu2oUR56gzlTvvrA6WGxi211 68/9Qx3qLzeDyTUgEHVjUBMX0sF5Ubk4EzLjX6MQmKF/KMZFLAQst/3TNnGxiwxoaLfS JM/l5x7TwvArK1P0uhAML6wj0srBj5dLa4ChUUKfriKszWmbkPg5EX9NPDp258v+k+L1 otSQR9g63sXF8dAXten1SqDU0/Xn4e8/xEBSip7aaQQVmbeUETqIgTg1XjRBRPSVTFpm L2cFxOu2VoxUXgNW4YFZiZiPxh2t8mv4eYEURT1RidRIXDclQjG768YNScXoOgXvVTkh k0hw== 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=QpGVvy5rFtpt1I3EghmBCd4MZ8W3VYp5IuJnc9OdUU0=; b=HRG/iVqYfBBNKZxLR8B8ZrpOZcd0f3xxJgDHRcltphohDZiVX5SqXJXd5wwzDFI9Wc mG1MujOmw142IpHv44dcW1v2TmGS8xv57IFuBcyRfu+gBa9v2ObRfeckMuQzG4M+p4Qb bdPGs35/JOk3a/DcLiiWp5fQB0PSH8xu6qK/J3JUEPVfHN1xDcfZWPS0Y1apOFwUkq1Z cfA8qXySoNes9Cdb8BYWyt/eJTs7JdBVKGuUFbb3oVpHEnIpWppHJpYDmON5bQQH2LV5 sDPHSwlgnjXcCnNvos53xo00OhwbxtpCgbKfmzyf5STMmDtbLqhSFdlw/SeSegBb9zLg ISrQ== 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 88-v6si12185031pla.342.2018.02.21.10.39.42; Wed, 21 Feb 2018 10:39:56 -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 S965701AbeBUNNL (ORCPT + 99 others); Wed, 21 Feb 2018 08:13:11 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45914 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753150AbeBUNNE (ORCPT ); Wed, 21 Feb 2018 08:13:04 -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 EE68010A2; Wed, 21 Feb 2018 13:13:03 +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.15 161/163] media: r820t: fix r820t_write_reg for KASAN Date: Wed, 21 Feb 2018 13:49:50 +0100 Message-Id: <20180221124538.808129304@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@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.15-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)