staging: gdm72xx: return -EINVAL instead of BUG_ON for invalid data length
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>
This commit is contained in:
parent
78adbb284c
commit
0fbce84c6f
2 changed files with 4 additions and 2 deletions
|
|
@ -390,7 +390,8 @@ static int gdm_sdio_send(void *priv_dev, void *data, int len,
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -312,7 +312,8 @@ static int gdm_usb_send(void *priv_dev, void *data, int len,
|
|||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue