diff options
author | Dave Penkler <dpenkler@gmail.com> | 2024-11-04 18:50:02 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-11-07 09:27:33 +0100 |
commit | 8023618a48dc8664a4493cc8279f988f9bd4ed0b (patch) | |
tree | bb35d5973ef20e76e5e98e161069059337f42682 | |
parent | 1235b909d312b5e56e26a8e7310ba948a4811940 (diff) |
staging: gpib: Fix buffer overflow in ni_usb_init
The writes buffer size was not taking into account the number of
entries in the array which was causing random oopses.
Fixes: 4e127de14fa7 ("staging: gpib: Add National Instruments USB GPIB driver")
Signed-off-by: Dave Penkler <dpenkler@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20241104175014.12317-2-dpenkler@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c index 571f07800c9a0..b7550a937f15c 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -1726,7 +1726,7 @@ static int ni_usb_init(gpib_board_t *board) unsigned int ibsta; int writes_len; - writes = kmalloc(sizeof(*writes), GFP_KERNEL); + writes = kmalloc_array(NUM_INIT_WRITES, sizeof(*writes), GFP_KERNEL); if (!writes) return -ENOMEM; |