This patch changes gdm_usb_send() and gdm_sdio_send() to return -EINVAL instead
of calling BUG_ON if an invalid data length is passed to the functions.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Michalis Pappas <mpappas@fastmail.fm>
Signed-off-by: Ben Chan <benchan@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
u16 cmd_evt;
unsigned long flags;
- BUG_ON(len > TX_BUF_SIZE - TYPE_A_HEADER_SIZE);
+ if (len > TX_BUF_SIZE - TYPE_A_HEADER_SIZE)
+ return -EINVAL;
spin_lock_irqsave(&tx->lock, flags);
return -ENODEV;
}
- BUG_ON(len > TX_BUF_SIZE - padding - 1);
+ if (len > TX_BUF_SIZE - padding - 1)
+ return -EINVAL;
spin_lock_irqsave(&tx->lock, flags);