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>
This commit is contained in:
parent
3864c897a7
commit
52e0b9fcd6
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue