]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
USB: sisusbvga: Fix a potential UB casued by left shifting a negative value
authorChangming Liu <charley.ashbringer@gmail.com>
Sat, 11 Jul 2020 04:30:18 +0000 (00:30 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:22:28 +0000 (11:22 +0200)
commit2a985b62c2d2c6a7e14f8272f53908bdbce26146
treed4d5d32a46639d18cf06359110dbb8ed7deb7581
parent63ccfdbca5deedf014874291d6dd772169a6ae7e
USB: sisusbvga: Fix a potential UB casued by left shifting a negative value

[ Upstream commit 2b53a19284f537168fb506f2f40d7fda40a01162 ]

The char buffer buf, receives data directly from user space,
so its content might be negative and its elements are left
shifted to form an unsigned integer.

Since left shifting a negative value is undefined behavior, thus
change the char to u8 to elimintate this UB.

Signed-off-by: Changming Liu <charley.ashbringer@gmail.com>
Link: https://lore.kernel.org/r/20200711043018.928-1-charley.ashbringer@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/misc/sisusbvga/sisusb.c