[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170302163834.2273519-16-arnd@arndb.de>
Date: Thu, 2 Mar 2017 17:38:23 +0100
From: Arnd Bergmann <arnd@...db.de>
To: kasan-dev@...glegroups.com
Cc: Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
linux-wireless@...r.kernel.org,
kernel-build-reports@...ts.linaro.org,
"David S . Miller" <davem@...emloft.net>,
Arnd Bergmann <arnd@...db.de>
Subject: [PATCH 15/26] [media] tuners: i2c: reduce stack usage for tuner_i2c_xfer_*
When CONFIG_KASAN is enabled, we see very large stack usage in some
functions, e.g.:
drivers/media/tuners/tda8290.c: In function 'tda8290_set_params':
drivers/media/tuners/tda8290.c:310:1: warning: the frame size of 3184 bytes is larger than 1024 bytes [-Wframe-larger-than=]
drivers/media/tuners/tda8290.c: In function 'tda829x_probe':
drivers/media/tuners/tda8290.c:878:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=]
By annotating the helpers as noinline_for_kasan, we can easily avoid this.
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
drivers/media/tuners/tuner-i2c.h | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/media/tuners/tuner-i2c.h b/drivers/media/tuners/tuner-i2c.h
index bda67a5a76f2..c8970299799c 100644
--- a/drivers/media/tuners/tuner-i2c.h
+++ b/drivers/media/tuners/tuner-i2c.h
@@ -33,8 +33,8 @@ struct tuner_i2c_props {
char *name;
};
-static inline int tuner_i2c_xfer_send(struct tuner_i2c_props *props,
- unsigned char *buf, int len)
+static noinline_for_kasan int
+tuner_i2c_xfer_send(struct tuner_i2c_props *props, unsigned char *buf, int len)
{
struct i2c_msg msg = { .addr = props->addr, .flags = 0,
.buf = buf, .len = len };
@@ -43,8 +43,8 @@ static inline int tuner_i2c_xfer_send(struct tuner_i2c_props *props,
return (ret == 1) ? len : ret;
}
-static inline int tuner_i2c_xfer_recv(struct tuner_i2c_props *props,
- unsigned char *buf, int len)
+static noinline_for_kasan int
+tuner_i2c_xfer_recv(struct tuner_i2c_props *props, unsigned char *buf, int len)
{
struct i2c_msg msg = { .addr = props->addr, .flags = I2C_M_RD,
.buf = buf, .len = len };
@@ -53,9 +53,10 @@ static inline int tuner_i2c_xfer_recv(struct tuner_i2c_props *props,
return (ret == 1) ? len : ret;
}
-static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props,
- unsigned char *obuf, int olen,
- unsigned char *ibuf, int ilen)
+static noinline_for_kasan int
+tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props,
+ unsigned char *obuf, int olen,
+ unsigned char *ibuf, int ilen)
{
struct i2c_msg msg[2] = { { .addr = props->addr, .flags = 0,
.buf = obuf, .len = olen },
--
2.9.0
Powered by blists - more mailing lists