linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] staging: rtl8192e: Fix signedness bug in rtllib_rx_assoc_resp()
@ 2022-04-15  2:09 Haowen Bai
  2022-04-15  5:22 ` Fabio M. De Francesco
  2022-04-15  5:25 ` [PATCH V2] " Dan Carpenter
  0 siblings, 2 replies; 19+ messages in thread
From: Haowen Bai @ 2022-04-15  2:09 UTC (permalink / raw)
  To: gregkh, davem, dan.carpenter, len.baker, dave, edumazet
  Cc: linux-staging, linux-kernel, Haowen Bai

function rtllib_rx_assoc_resp () unsigned errcode receive auth_parse()'s
errcode -ENOMEM.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
V1->V2: reduce return random value; print its own error message.

 drivers/staging/rtl8192e/rtllib_softmac.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 82bf05eb1cbf..8a0961e64a8c 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -1764,7 +1764,7 @@ static void rtllib_softmac_check_all_nets(struct rtllib_device *ieee)
 	spin_unlock_irqrestore(&ieee->lock, flags);
 }
 
-static inline u16 auth_parse(struct net_device *dev, struct sk_buff *skb,
+static inline s16 auth_parse(struct net_device *dev, struct sk_buff *skb,
 			     u8 **challenge, int *chlen)
 {
 	struct rtllib_authentication *a;
@@ -1773,7 +1773,7 @@ static inline u16 auth_parse(struct net_device *dev, struct sk_buff *skb,
 	if (skb->len <  (sizeof(struct rtllib_authentication) -
 	    sizeof(struct rtllib_info_element))) {
 		netdev_dbg(dev, "invalid len in auth resp: %d\n", skb->len);
-		return 0xcafe;
+		return -EINVAL;
 	}
 	*challenge = NULL;
 	a = (struct rtllib_authentication *) skb->data;
@@ -1787,7 +1787,7 @@ static inline u16 auth_parse(struct net_device *dev, struct sk_buff *skb,
 				return -ENOMEM;
 		}
 	}
-	return le16_to_cpu(a->status);
+	return a->status;
 }
 
 static int auth_rq_parse(struct net_device *dev, struct sk_buff *skb, u8 *dest)
@@ -2282,7 +2282,7 @@ rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb,
 
 static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb)
 {
-	u16 errcode;
+	s16 errcode;
 	u8 *challenge;
 	int chlen = 0;
 	bool bSupportNmode = true, bHalfSupportNmode = false;
@@ -2292,8 +2292,8 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb)
 	if (errcode) {
 		ieee->softmac_stats.rx_auth_rs_err++;
 		netdev_info(ieee->dev,
-			    "Authentication response status code 0x%x",
-			    errcode);
+			    "Authentication response status code %d",
+			    le16_to_cpu(errcode));
 		rtllib_associate_abort(ieee);
 		return;
 	}
-- 
2.7.4


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

end of thread, other threads:[~2022-04-21 16:26 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-15  2:09 [PATCH V2] staging: rtl8192e: Fix signedness bug in rtllib_rx_assoc_resp() Haowen Bai
2022-04-15  5:22 ` Fabio M. De Francesco
2022-04-15  5:31   ` Dan Carpenter
2022-04-15  5:50     ` [PATCH V3] " Haowen Bai
2022-04-15  6:06       ` Fabio M. De Francesco
2022-04-15  6:10         ` Fabio M. De Francesco
2022-04-15  6:15           ` [PATCH V4] " Haowen Bai
2022-04-15  6:20             ` Dan Carpenter
2022-04-15  6:39               ` Haowen Bai
2022-04-15  6:58                 ` Dan Carpenter
2022-04-15  7:21                   ` Haowen Bai
2022-04-20 16:41                     ` Greg Kroah-Hartman
2022-04-21  1:34                       ` Haowen Bai
2022-04-21  8:09                         ` kernel test robot
2022-04-21  8:21                           ` [PATCH V5] " Haowen Bai
2022-04-21 16:22                             ` Dan Carpenter
2022-04-18  1:48                   ` [PATCH V4] " baihaowen
2022-04-15  6:18       ` [PATCH V3] " Dan Carpenter
2022-04-15  5:25 ` [PATCH V2] " Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).