media: don't do a 31 bit shift on a signed int
On 32-bits archs, a signed integer has 31 bits plus on extra bit for signal. Due to that, touching the 32th bit with something like: int bar = 1 << 31; has an undefined behavior in C on 32 bit architectures, as it touches the signal bit. This is warned by cppcheck. Instead, force the numbers to be unsigned, in order to solve this issue. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
@@ -1388,7 +1388,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
|
||||
(char)((fmt->pixelformat >> 8) & 0x7f),
|
||||
(char)((fmt->pixelformat >> 16) & 0x7f),
|
||||
(char)((fmt->pixelformat >> 24) & 0x7f),
|
||||
(fmt->pixelformat & (1 << 31)) ? "-BE" : "");
|
||||
(fmt->pixelformat & (1UL << 31)) ? "-BE" : "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user