diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2011-11-08 03:31:47 (GMT) |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-11-09 21:14:13 (GMT) |
commit | 1eb54c8a0fa0061247f3bd327b320c3e20c97340 (patch) | |
tree | 497dd62c738b42682bce13cf8e2931a0f2aebcdc /drivers/net | |
parent | 7d7ab02204ae2af26944ccd8a4c599756bdf0fc3 (diff) | |
download | linux-1eb54c8a0fa0061247f3bd327b320c3e20c97340.tar.xz |
mwifiex: prevent corruption instead of just warning
Probably we never hit this condition, but in case we do, we may as
well put a return here instead of just printing a warning message and
then corrupting memory. The caller doesn't check the return code.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/mwifiex/pcie.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index d12d440..a2f3200 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c @@ -1228,9 +1228,12 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter, if (!skb) return 0; - if (rdptr >= MWIFIEX_MAX_EVT_BD) + if (rdptr >= MWIFIEX_MAX_EVT_BD) { dev_err(adapter->dev, "event_complete: Invalid rdptr 0x%x\n", rdptr); + ret = -EINVAL; + goto done; + } /* Read the event ring write pointer set by firmware */ if (mwifiex_read_reg(adapter, REG_EVTBD_WRPTR, &wrptr)) { |