From: Michael Buesch Date: Fri, 2 Nov 2007 17:35:02 +0000 (+0100) Subject: b43: debugfs SHM read buffer overrun fix X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=30c4ae42317666f3aeed658cdb8803c84ac6fe77;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git b43: debugfs SHM read buffer overrun fix Fix possible buffer overrun. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index 734e70e1a06d..ef0075d9f9cb 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c @@ -128,7 +128,7 @@ static ssize_t shm_read_file(struct b43_wldev *dev, __le16 *le16buf = (__le16 *)buf; for (i = 0; i < 0x1000; i++) { - if (bufsize <= 0) + if (bufsize < sizeof(tmp)) break; tmp = b43_shm_read16(dev, B43_SHM_SHARED, 2 * i); le16buf[i] = cpu_to_le16(tmp);