From: Dan Carpenter Date: Thu, 17 Oct 2024 19:31:46 +0000 (+0300) Subject: staging: gpib: fix uninitialized variable in usb_gpib_command() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1f6bfe18d0fc1c4f22720ed163c85f692ea65c6a;p=users%2Fdwmw2%2Flinux.git staging: gpib: fix uninitialized variable in usb_gpib_command() The number of bytes written is supposed to be zero at the start of this function but only one caller, ibcmd(), initializes it to zero. For the other three callers, setup_serial_poll(), read_serial_poll_byte() and cleanup_serial_poll(), it's an uninitialized variable. Fixes: fce79512a96a ("staging: gpib: Add LPVO DIY USB GPIB driver") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/a7fed100-ea4d-4dd8-97c6-3fbd2c15f795@stanley.mountain Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c index 2a8f127de4277..4c580137043f6 100644 --- a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +++ b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c @@ -597,6 +597,7 @@ static int usb_gpib_command(gpib_board_t *board, set_timeout(board); + *bytes_written = 0; for (i = 0 ; i < length ; i++) { command[3] = buffer[i]; retval = send_command(board, command, 5);