]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerTakashi Iwai <tiwai@suse.de>
Tue, 26 May 2020 06:18:24 +0000 (08:18 +0200)
commit2f43b693dfb6a766508e71f2a7c2ada55af735f9
tree11ad21509a11fbbde361a819ad867e7d54531236
parentc60d7df7ba039ccb30d1dba8f8c8a387f43998b8
ALSA: hwdep: fix a left shifting 1 by 31 UB bug

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