linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] staging: Fix bitshifts by wrong offsets in wilc1000/host_interface.c
@ 2015-12-02  2:49 Mario J. Rugiero
  2015-12-18 22:50 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Mario J. Rugiero @ 2015-12-02  2:49 UTC (permalink / raw)
  To: devel
  Cc: mrugiero, gregkh, linux-wireless, johnny.kim, austin.shin,
	chris.park, tony.cho, glen.lee, leo.kim

struct set_multicast uses (implicitly) sizeof(bool) to determine how many bytes to copy in
Handle_SetMulticastFilter. Since that is implementation defined, it triggered sparse to
rightfully complain about shifting a bigger value than supported.
Since it was used as if assuming it was 32 bits, I replaced the bool member by a u32.
Also, time_out and buf_size members of ba_session_info are u16, but while copying their
bytes into ptr in Handle_AddBASession shift 16 bits for the second byte instead of 8 bits.
This patch fixes those two issues.

Signed-off-by: Mario J. Rugiero <mrugiero@gmail.com>
---
 drivers/staging/wilc1000/host_interface.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 0c87f6c..fcfd70a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -142,7 +142,7 @@ struct beacon_attr {
 };
 
 struct set_multicast {
-	bool enabled;
+	u32 enabled;
 	u32 cnt;
 };
 
@@ -2752,9 +2752,9 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv,
 	*ptr++ = strHostIfBASessionInfo->tid;
 	*ptr++ = 1;
 	*ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF);
-	*ptr++ = ((strHostIfBASessionInfo->buf_size >> 16) & 0xFF);
+	*ptr++ = ((strHostIfBASessionInfo->buf_size >> 8) & 0xFF);
 	*ptr++ = (strHostIfBASessionInfo->time_out & 0xFF);
-	*ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF);
+	*ptr++ = ((strHostIfBASessionInfo->time_out >> 8) & 0xFF);
 	*ptr++ = (AddbaTimeout & 0xFF);
 	*ptr++ = ((AddbaTimeout >> 16) & 0xFF);
 	*ptr++ = 8;
@@ -2777,7 +2777,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv,
 	*ptr++ = strHostIfBASessionInfo->tid;
 	*ptr++ = 8;
 	*ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF);
-	*ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF);
+	*ptr++ = ((strHostIfBASessionInfo->time_out >> 8) & 0xFF);
 	*ptr++ = 3;
 	result = send_config_pkt(SET_CFG, &wid, 1,
 				 get_id_from_handler(hif_drv));
-- 
2.6.2


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

end of thread, other threads:[~2015-12-19  1:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02  2:49 [PATCH 1/1] staging: Fix bitshifts by wrong offsets in wilc1000/host_interface.c Mario J. Rugiero
2015-12-18 22:50 ` Greg KH
2015-12-19  1:16   ` Mario J. Rugiero

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).