Do not use dynamic stack allocation.
>> drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c:181:1:
warning: 'rtl2832_sdr_wr' uses dynamic stack allocation [enabled by default]
Reported-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
int len)
{
int ret;
- u8 buf[1 + len];
+#define MAX_WR_LEN 24
+#define MAX_WR_XFER_LEN (MAX_WR_LEN + 1)
+ u8 buf[MAX_WR_XFER_LEN];
struct i2c_msg msg[1] = {
{
.addr = s->cfg->i2c_addr,
}
};
+ if (WARN_ON(len > MAX_WR_LEN))
+ return -EINVAL;
+
buf[0] = reg;
memcpy(&buf[1], val, len);