Commit 567f94ec authored by Hans Verkuil's avatar Hans Verkuil Committed by sanglipeng
Browse files

media: tuners: qt1010: replace BUG_ON with a regular error

stable inclusion
from stable-v5.10.197
commit 2ae53dd15eef90d34fc084b5b2305a67bb675a26
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I96Q8P

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2ae53dd15eef90d34fc084b5b2305a67bb675a26



--------------------------------

[ Upstream commit ee630b29 ]

BUG_ON is unnecessary here, and in addition it confuses smatch.
Replacing this with an error return help resolve this smatch
warning:

drivers/media/tuners/qt1010.c:350 qt1010_init() error: buffer overflow 'i2c_data' 34 <= 34

Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 4195b685
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -345,8 +345,9 @@ static int qt1010_init(struct dvb_frontend *fe)
			else
				valptr = &tmpval;

			BUG_ON(i >= ARRAY_SIZE(i2c_data) - 1);

			if (i >= ARRAY_SIZE(i2c_data) - 1)
				err = -EIO;
			else
				err = qt1010_init_meas1(priv, i2c_data[i + 1].reg,
							i2c_data[i].reg,
							i2c_data[i].val, valptr);