OSDN Git Service

media: don't do a 31 bit shift on a signed int
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 22 Aug 2019 14:16:42 +0000 (11:16 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 26 Aug 2019 17:11:10 +0000 (14:11 -0300)
commit95c520690f5fafb2cda2ec17f8c76ab3422b0174
tree0dec0f5683f21100b61b19a141512ebe0bac3aea
parentcce8ccca80d8388982133192d0a6d9dc2e8ed712
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>
19 files changed:
drivers/media/dvb-frontends/cx24123.c
drivers/media/pci/bt8xx/bttv-input.c
drivers/media/pci/cx18/cx18-ioctl.c
drivers/media/pci/ivtv/ivtv-driver.c
drivers/media/pci/ivtv/ivtv-ioctl.c
drivers/media/pci/solo6x10/solo6x10-gpio.c
drivers/media/platform/exynos4-is/mipi-csis.c
drivers/media/platform/fsl-viu.c
drivers/media/platform/mx2_emmaprp.c
drivers/media/platform/pxa_camera.c
drivers/media/platform/qcom/venus/core.c
drivers/media/platform/s5p-jpeg/jpeg-regs.h
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
drivers/media/radio/radio-gemtek.c
drivers/media/usb/dvb-usb-v2/gl861.c
drivers/media/usb/pvrusb2/pvrusb2-hdw.c
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
drivers/media/v4l2-core/v4l2-ioctl.c