linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: "linux-wireless" <linux-wireless@vger.kernel.org>
Subject: [PATCH] airo: Fix integer overflow warning
Date: Wed, 25 Nov 2009 22:55:11 +0100	[thread overview]
Message-ID: <200911252255.11570.mb@bu3sch.de> (raw)

On BigEndian gcc complains:

drivers/net/wireless/airo.c: In function ‘sniffing_mode’:
drivers/net/wireless/airo.c:4809: warning: integer overflow in expression

Fix this by doing the bitwise AND on the host-endian value.

---

I don't know why GCC warns, however. The original code looks OK to me, too.


Index: wireless-testing/drivers/net/wireless/airo.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/airo.c	2009-11-01 13:58:47.000000000 +0100
+++ wireless-testing/drivers/net/wireless/airo.c	2009-11-25 22:49:18.000000000 +0100
@@ -4806,7 +4806,7 @@ static int airo_config_commit(struct net
 
 static inline int sniffing_mode(struct airo_info *ai)
 {
-	return le16_to_cpu(ai->config.rmode & RXMODE_MASK) >=
+	return (le16_to_cpu(ai->config.rmode) & le16_to_cpu(RXMODE_MASK)) >=
 		le16_to_cpu(RXMODE_RFMON);
 }
 

-- 
Greetings, Michael.

                 reply	other threads:[~2009-11-25 21:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200911252255.11570.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).