Nick Briggs:

>       The code in if_tl.c, tl_calchash() is wrong in that it doesn't 
> compensate for signed char type so that the XOR operations to generate the 
> multicast hash index are polluted by sign extension if the MSbit of the 1st 
> and 4th or 2nd and 5th bytes of the multicast destination ethernet address 
> are not equal.  This is the patch for that problem:

We should just use unsigned chars.
Kill a prototype for a nonexisting function in a neighboring file,
while here.

Index: if_tl.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_tl.c,v
retrieving revision 1.70
diff -u -p -r1.70 if_tl.c
--- if_tl.c     22 Jan 2017 10:17:38 -0000      1.70
+++ if_tl.c     13 Jul 2017 14:39:09 -0000
@@ -272,7 +272,7 @@ void tl_miibus_writereg(struct device *,
 void tl_miibus_statchg(struct device *);
 
 void tl_setmode(struct tl_softc *, uint64_t);
-int tl_calchash(caddr_t);
+int tl_calchash(u_int8_t *);
 void tl_iff(struct tl_softc *);
 void tl_setfilt(struct tl_softc *, caddr_t, int);
 void tl_softreset(struct tl_softc *, int);
@@ -747,7 +747,7 @@ tl_setmode(struct tl_softc *sc, uint64_t
  * the folded 24-bit value is split into 6-bit portions and XOR'd.
  */
 int
-tl_calchash(caddr_t addr)
+tl_calchash(u_int8_t *addr)
 {
        int                     t;
 
Index: if_wb.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_wb.c,v
retrieving revision 1.68
diff -u -p -r1.68 if_wb.c
--- if_wb.c     22 Jan 2017 10:17:38 -0000      1.68
+++ if_wb.c     13 Jul 2017 14:36:07 -0000
@@ -154,7 +154,6 @@ int wb_mii_readreg(struct wb_softc *, st
 int wb_mii_writereg(struct wb_softc *, struct wb_mii_frame *);
 
 void wb_setcfg(struct wb_softc *, uint64_t);
-u_int8_t wb_calchash(caddr_t);
 void wb_setmulti(struct wb_softc *);
 void wb_reset(struct wb_softc *);
 void wb_fixmedia(struct wb_softc *);
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to