aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann2017-11-30 05:08:05 -0600
committerGreg Kroah-Hartman2018-02-22 08:45:02 -0600
commitc4fd9c8d38575cfcd90dce8162d52ac74158cefc (patch)
treee29c0d4090eab5192e3c9aa40a0532a9568f3af1
parent193cfa7632a490a86faa3af1969d63c63873d8be (diff)
downloadkernel-omap-c4fd9c8d38575cfcd90dce8162d52ac74158cefc.tar.gz
kernel-omap-c4fd9c8d38575cfcd90dce8162d52ac74158cefc.tar.xz
kernel-omap-c4fd9c8d38575cfcd90dce8162d52ac74158cefc.zip
media: r820t: fix r820t_write_reg for KASAN
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 <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/media/tuners/r820t.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c
index a7a8452e99d2..c1ce8d3ce877 100644
--- a/drivers/media/tuners/r820t.c
+++ b/drivers/media/tuners/r820t.c
@@ -410,9 +410,11 @@ static int r820t_write(struct r820t_priv *priv, u8 reg, const u8 *val,
410 return 0; 410 return 0;
411} 411}
412 412
413static int r820t_write_reg(struct r820t_priv *priv, u8 reg, u8 val) 413static inline int r820t_write_reg(struct r820t_priv *priv, u8 reg, u8 val)
414{ 414{
415 return r820t_write(priv, reg, &val, 1); 415 u8 tmp = val; /* work around GCC PR81715 with asan-stack=1 */
416
417 return r820t_write(priv, reg, &tmp, 1);
416} 418}
417 419
418static int r820t_read_cache_reg(struct r820t_priv *priv, int reg) 420static int r820t_read_cache_reg(struct r820t_priv *priv, int reg)
@@ -425,17 +427,18 @@ static int r820t_read_cache_reg(struct r820t_priv *priv, int reg)
425 return -EINVAL; 427 return -EINVAL;
426} 428}
427 429
428static int r820t_write_reg_mask(struct r820t_priv *priv, u8 reg, u8 val, 430static inline int r820t_write_reg_mask(struct r820t_priv *priv, u8 reg, u8 val,
429 u8 bit_mask) 431 u8 bit_mask)
430{ 432{
433 u8 tmp = val;
431 int rc = r820t_read_cache_reg(priv, reg); 434 int rc = r820t_read_cache_reg(priv, reg);
432 435
433 if (rc < 0) 436 if (rc < 0)
434 return rc; 437 return rc;
435 438
436 val = (rc & ~bit_mask) | (val & bit_mask); 439 tmp = (rc & ~bit_mask) | (tmp & bit_mask);
437 440
438 return r820t_write(priv, reg, &val, 1); 441 return r820t_write(priv, reg, &tmp, 1);
439} 442}
440 443
441static int r820t_read(struct r820t_priv *priv, u8 reg, u8 *val, int len) 444static int r820t_read(struct r820t_priv *priv, u8 reg, u8 *val, int len)