mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 16:12:59 +02:00
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: 4e127de14f ("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>
This commit is contained in:
parent
1235b909d3
commit
8023618a48
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user