Commit 33472b7e authored by Colin Ian King's avatar Colin Ian King Committed by Stefan Bader

ALSA: usb-audio: fix sign unintended sign extension on left shifts

BugLink: https://bugs.launchpad.net/bugs/1836668

commit 2acf5a3e 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: default avatarColin Ian King <colin.king@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 1fb8187e
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment