ALSA: usb-audio: Fix unintentional sign extension issue
authorColin Ian King <colin.king@canonical.com>
Thu, 18 Mar 2021 13:20:08 +0000 (13:20 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Mar 2021 08:04:07 +0000 (09:04 +0100)
commit2d202085d2dd53b8364a17050887a805c9e1601f
tree4da68e289697205c9685bf3e9adc3b81f194e7cc
parent64195f022ae8c24e0abccc1545d557b064e73ed3
ALSA: usb-audio: Fix unintentional sign extension issue

commit 50b1affc891cbc103a2334ce909a026e25f4c84d upstream.

The shifting of the u8 integer device by 24 bits to the left will
be promoted to a 32 bit signed int and then sign-extended to a
64 bit unsigned long. In the event that the top bit of device is
set then all then all the upper 32 bits of the unsigned long will
end up as also being set because of the sign-extension. Fix this
by casting device to an unsigned long before the shift.

Addresses-Coverity: ("Unintended sign extension")
Fixes: a07df82c7990 ("ALSA: usb-audio: Add DJM750 to Pioneer mixer quirk")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210318132008.15266-1-colin.king@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/usb/mixer_quirks.c