Re: UBSAN: shift-out-of-bounds in drivers/media/usb/uvc/uvc_ctrl.c:781

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bart/Laurent,

On Tue, Aug 18, 2020 at 2:41 PM Bart Van Assche <bvanassche@xxxxxxx> wrote:
>
> Hi,
>
> This morning I installed a debug build of kernel v5.8.1 on my laptop.
> The complaint shown below appeared in the kernel log. Is this a known
> issue?
>
> Thanks,
>
> Bart.
>
> ================================================================================
> UBSAN: shift-out-of-bounds in drivers/media/usb/uvc/uvc_ctrl.c:781:13
> shift exponent -7 is negative

Should we fix it like this?

--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -778,7 +778,7 @@ static s32 uvc_get_le_value(struct
uvc_control_mapping *mapping,
                value |= offset > 0 ? (byte >> offset) : (byte << (-offset));
                bits -= 8 - (offset > 0 ? offset : 0);
                offset -= 8;
-               mask = (1 << bits) - 1;
+               mask = (1LL << bits) - 1;
        }



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux