mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2.6.2] drivers/net/bonding/bond_alb.c
@ 2004-02-05  6:50 Bryan Whitehead
  2004-02-05  6:55 ` Bryan Whitehead
  0 siblings, 1 reply; 3+ messages in thread
From: Bryan Whitehead @ 2004-02-05  6:50 UTC (permalink / raw)
  To: ctindel; +Cc: linux-kernel


__constant_htons is used on a variable that is only a byte. This results
in an if statement always returning true in function bond_alb_xmit.

This is the compiler warning on gcc 3.3.2 a gentoo linux system:
  CC [M]  drivers/net/bonding/bond_alb.o
drivers/net/bonding/bond_alb.c: In function `bond_alb_xmit':
drivers/net/bonding/bond_alb.c:1340: warning: comparison is always true due to limited range of data type

Here is the patch:
--- linux-2.6.2/drivers/net/bonding/bond_alb.c.orig     2004-02-04 15:08:04.228336168 -0800
+++ linux-2.6.2/drivers/net/bonding/bond_alb.c  2004-02-04 15:26:03.769221008 -0800
@@ -1336,8 +1336,7 @@ bond_alb_xmit(struct sk_buff *skb, struc
                        break;
                }
  
-               if (ipx_hdr(skb)->ipx_type !=
-                   __constant_htons(IPX_TYPE_NCP)) {
+               if (ipx_hdr(skb)->ipx_type != IPX_TYPE_NCP) {
                        /* The only protocol worth balancing in
                         * this family since it has an "ARP" like
                         * mechanism


--
Bryan Whitehead
driver@megahappy.net

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH 2.6.2] drivers/net/bonding/bond_alb.c
@ 2004-02-04 23:33 Bryan Whitehead
  0 siblings, 0 replies; 3+ messages in thread
From: Bryan Whitehead @ 2004-02-04 23:33 UTC (permalink / raw)
  To: ctindel; +Cc: bonding-devel, linux-kernel

Building with gcc 3.3.2 on gentoo linux on Athlon x86 system I get
a warning:
  CC [M]  drivers/net/bonding/bond_alb.o
drivers/net/bonding/bond_alb.c: In function `bond_alb_xmit':
drivers/net/bonding/bond_alb.c:1340: warning: comparison is always true due to limited range of data type                                                                                                         
This is due to using __constant_htons for endian issues. This is a byte so there
is no point in using __constant_htons in the first place. Unless I'm mistaken using
__constant_htons makes this statment always true as the compiler states.
 
if ipx_type = IPX_TYPE_NCP then the intended logic will not happen?

--- linux-2.6.2/drivers/net/bonding/bond_alb.c.orig     2004-02-04 15:08:04.228336168 -0800
+++ linux-2.6.2/drivers/net/bonding/bond_alb.c  2004-02-04 15:26:03.769221008 -0800
@@ -1336,8 +1336,7 @@ bond_alb_xmit(struct sk_buff *skb, struc
                        break;
                }
  
-               if (ipx_hdr(skb)->ipx_type !=
-                   __constant_htons(IPX_TYPE_NCP)) {
+               if (ipx_hdr(skb)->ipx_type != IPX_TYPE_NCP) {
                        /* The only protocol worth balancing in
                         * this family since it has an "ARP" like
                         * mechanism


--
Bryan Whitehead
Email:driver@megahappy.net
WorkE:driver@jpl.nasa.gov

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

end of thread, other threads:[~2004-02-05  7:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-05  6:50 [PATCH 2.6.2] drivers/net/bonding/bond_alb.c Bryan Whitehead
2004-02-05  6:55 ` Bryan Whitehead
  -- strict thread matches above, loose matches on Subject: below --
2004-02-04 23:33 Bryan Whitehead

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

all inboxes | Powered by JetHome®