]> git.baikalelectronics.ru Git - kernel.git/commit
media: cec-pin-error-inj: avoid a false-positive Spectre detection
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 15 May 2018 19:23:16 +0000 (15:23 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 28 May 2018 20:11:17 +0000 (16:11 -0400)
commitb44aefa0ba155913bd6b903a5caf0e6272e2216b
tree451f3bb582edfa75300f5b8a35c51f5867b471ad
parente2c07a88b8a47ce7b88214754bdf4b20ebc890fa
media: cec-pin-error-inj: avoid a false-positive Spectre detection

The current logic makes Smatch to false-detect a Spectre variant 1
vulnerability. The problem is that it initializes an u32 indirectly
from user space input.

After trying to write a fixup, after a while I realized that, in
practice, this shouldn't be a problem, as an u32 is initialized
from u8, but it took some time to discover it.

So, do some code cleanup to make it clearer for both humans
and machines about the valid range for "op".

Fix this warning:
drivers/media/cec/cec-pin-error-inj.c:170 cec_pin_error_inj_parse_line() warn: potential spectre issue 'pin->error_inj_args'

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/cec/cec-pin-error-inj.c