Patch "media: r820t: fix r820t_write_reg for KASAN" has been added to the 4.4-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
media: r820t: fix r820t_write_reg for KASAN
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
media-r820t-fix-r820t_write_reg-for-kasan.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
16c3ada89cff9a8c2a0eea34ffa1aa20af3f6008Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Thu, 30 Nov 2017 06:08:05 -0500
Subject: media: r820t: fix r820t_write_reg for KASAN
From: Arnd Bergmann <[email protected]>
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.
--- drivers/media/tuners/r820t.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/media/tuners/r820t.c +8 -5
@@ -410,9 +410,11 @@ static int r820t_write(struct r820t_privreturn 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)
@@ -425,17 +427,18 @@ static int r820t_read_cache_reg(struct rreturn -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)
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/arm-spear600-add-missing-interrupt-parent-of-rtc.patch queue-4.4/media-r820t-fix-r820t_write_reg-for-kasan.patch queue-4.4/arm-dts-sti-add-gpio-polarity-for-hdmi-hpd-gpio-property.patch queue-4.4/arm-spear13xx-fix-spics-gpio-controller-s-warning.patch queue-4.4/x86-fix-build-warnign-with-32-bit-pae.patch queue-4.4/mm-hide-a-warning-for-compile_test.patch queue-4.4/arm-pxa-tosa-bt-add-module_license-tag.patch queue-4.4/arm-dts-s5pv210-add-interrupt-parent-for-ohci.patch queue-4.4/arm-spear13xx-fix-dmas-cells.patch