Commit 8023618a authored by Dave Penkler's avatar Dave Penkler Committed by Greg Kroah-Hartman
Browse files

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: 4e127de1 ("staging: gpib: Add National Instruments USB GPIB driver")
Signed-off-by: default avatarDave Penkler <dpenkler@gmail.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20241104175014.12317-2-dpenkler@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1235b909
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;