ALSA: hwdep: fix a left shifting 1 by 31 UB bug
authorChangming Liu <liu.changm@northeastern.edu>
Tue, 26 May 2020 00:39:21 +0000 (00:39 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jun 2020 06:16:40 +0000 (08:16 +0200)
commit93b7bf07e595b0142b903f96abb6b34501765802
tree3fd4ab3315afc602ae3d6fa05fefea34e1b6e707
parent2ab343c835f705bce8d184e699e462d4719fa54a
ALSA: hwdep: fix a left shifting 1 by 31 UB bug

[ Upstream commit fb8cd6481ffd126f35e9e146a0dcf0c4e8899f2e ]

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>
sound/core/hwdep.c