summaryrefslogtreecommitdiff
path: root/sound/usb
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-06-27 17:43:08 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-10 09:55:46 +0200
commit443449d4a149a65f20585f5084673575d660eec5 (patch)
treece2ec927e2f4df8912626c10885919e302ba7761 /sound/usb
parent8b449e9dc215e47641c4737a199b7767ffd032a9 (diff)
ALSA: usb-audio: fix sign unintended sign extension on left shifts
commit 2acf5a3e6e9371e63c9e4ff54d84d08f630467a0 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/mixer_quirks.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 5d2fc5f58bfe..f4fd9548c529 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -753,7 +753,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;
}
@@ -914,7 +914,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;
}