mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-14 12:37:32 +00:00
ALSA: hwdep: fix a left shifting 1 by 31 UB bug
[ Upstream commit fb8cd6481f
]
The "info.index" variable can be 31 in "1 << info.index".
This might trigger an undefined behavior since 1 is signed.
Fix this by casting 1 to 1u just to be sure "1u << 31" is defined.
Signed-off-by: Changming Liu <liu.changm@northeastern.edu>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/BL0PR06MB4548170B842CB055C9AF695DE5B00@BL0PR06MB4548.namprd06.prod.outlook.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e8ed2ff71f
commit
f9ee8f97f9
1 changed files with 2 additions and 2 deletions
|
@ -231,12 +231,12 @@ static int snd_hwdep_dsp_load(struct snd_hwdep *hw,
|
|||
if (info.index >= 32)
|
||||
return -EINVAL;
|
||||
/* check whether the dsp was already loaded */
|
||||
if (hw->dsp_loaded & (1 << info.index))
|
||||
if (hw->dsp_loaded & (1u << info.index))
|
||||
return -EBUSY;
|
||||
err = hw->ops.dsp_load(hw, &info);
|
||||
if (err < 0)
|
||||
return err;
|
||||
hw->dsp_loaded |= (1 << info.index);
|
||||
hw->dsp_loaded |= (1u << info.index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue