diff options
author | Changming Liu <charley.ashbringer@gmail.com> | 2020-07-11 00:30:18 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-09-03 11:24:22 +0200 |
commit | c5b61db89d201dee13cc400eab1f7e0e49f4f7b2 (patch) | |
tree | df0ff2e9ae81331cc20c01be56dc64255e36a3e6 /drivers/usb | |
parent | 6a76cddecff0c7420c1d6785b77dd1823f36219d (diff) | |
download | linux-stable-c5b61db89d201dee13cc400eab1f7e0e49f4f7b2.tar.gz linux-stable-c5b61db89d201dee13cc400eab1f7e0e49f4f7b2.tar.bz2 linux-stable-c5b61db89d201dee13cc400eab1f7e0e49f4f7b2.zip |
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/misc/sisusbvga/sisusb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 6376be1f5fd2..4877bf82ad39 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c @@ -761,7 +761,7 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, u8 swap8, fromkern = kernbuffer ? 1 : 0; u16 swap16; u32 swap32, flag = (length >> 28) & 1; - char buf[4]; + u8 buf[4]; /* if neither kernbuffer not userbuffer are given, assume * data in obuf |