public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 3/4] mwifiex: prevent corruption instead of just warning
@ 2011-10-18  6:15 Dan Carpenter
  2011-10-18 18:19 ` Bing Zhao
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2011-10-18  6:15 UTC (permalink / raw)
  To: Bing Zhao; +Cc: John W. Linville, linux-wireless, kernel-janitors

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>

diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index d12d440..40b154d 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -1228,9 +1228,11 @@ 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);
+		return -EINVAL;
+	}
 
 	/* Read the event ring write pointer set by firmware */
 	if (mwifiex_read_reg(adapter, REG_EVTBD_WRPTR, &wrptr)) {

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-19 21:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-18  6:15 [patch 3/4] mwifiex: prevent corruption instead of just warning Dan Carpenter
2011-10-18 18:19 ` Bing Zhao
2011-10-18 18:23   ` Johannes Berg
2011-10-18 18:27     ` Bing Zhao
2011-10-19  7:32   ` [patch 3/4 v2] " Dan Carpenter
2011-10-19 21:29     ` [patch 3/4 v2] mwifiex: prevent corruption instead of just Bing Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox