diff options
author | Colin Ian King <colin.king@canonical.com> | 2019-06-27 17:43:08 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-06-28 10:37:34 +0200 |
commit | 2acf5a3e6e9371e63c9e4ff54d84d08f630467a0 (patch) | |
tree | 315a683f95aed870a72f6e1b3148059132915985 /sound | |
parent | 503d90b30602a3295978e46d844ccc8167400fe6 (diff) |
ALSA: usb-audio: fix sign unintended sign extension on left shifts
There are a couple of left shifts of unsigned 8 bit values that
first get promoted to signed ints and hence get sign extended
on the shift if the top bit of the 8 bit values are set. Fix
this by casting the 8 bit values to unsigned ints to stop the
unintentional sign extension.
Addresses-Coverity: ("Unintended sign extension")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/mixer_quirks.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index a751a18ca4c2..5783329a3237 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c @@ -754,7 +754,7 @@ static int snd_ni_control_init_val(struct usb_mixer_interface *mixer, return err; } - kctl->private_value |= (value << 24); + kctl->private_value |= ((unsigned int)value << 24); return 0; } @@ -915,7 +915,7 @@ static int snd_ftu_eff_switch_init(struct usb_mixer_interface *mixer, if (err < 0) return err; - kctl->private_value |= value[0] << 24; + kctl->private_value |= (unsigned int)value[0] << 24; return 0; } |