Commit 0fbce84c authored by Ben Chan's avatar Ben Chan Committed by Greg Kroah-Hartman

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reported-by: default avatarMichalis Pappas <mpappas@fastmail.fm>
Signed-off-by: default avatarBen Chan <benchan@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 78adbb28
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment