提交 0fbce84c 编写于 作者: B Ben Chan 提交者: 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: NDan Carpenter <dan.carpenter@oracle.com>
Reported-by: NMichalis Pappas <mpappas@fastmail.fm>
Signed-off-by: NBen Chan <benchan@chromium.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册