Selaa lähdekoodia

[tg3] Fix _tg3_flag() for 64-bit builds

Commit 86f96a4 ("[tg3] Remove x86-specific inline assembly")
introduced a regression in _tg3_flag() in 64-bit builds, since any
flags in the upper 32 bits of a 64-bit unsigned long would be
discarded when truncating to a 32-bit int.

Debugged-by: Shane Thompson <shane.thompson@aeontech.com.au>
Tested-by: Shane Thompson <shane.thompson@aeontech.com.au>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 vuotta sitten
vanhempi
commit
fe62f3c831
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1
    1
      src/drivers/net/tg3/tg3.h

+ 1
- 1
src/drivers/net/tg3/tg3.h Näytä tiedosto

3324
 {
3324
 {
3325
 	unsigned int index = ( flag / ( 8 * sizeof ( *bits ) ) );
3325
 	unsigned int index = ( flag / ( 8 * sizeof ( *bits ) ) );
3326
 	unsigned int bit = ( flag % ( 8 * sizeof ( *bits ) ) );
3326
 	unsigned int bit = ( flag % ( 8 * sizeof ( *bits ) ) );
3327
-	return ( bits[index] & ( 1UL << bit ) );
3327
+	return ( !! ( bits[index] & ( 1UL << bit ) ) );
3328
 }
3328
 }
3329
 
3329
 
3330
 static inline void _tg3_flag_set(enum TG3_FLAGS flag, unsigned long *bits)
3330
 static inline void _tg3_flag_set(enum TG3_FLAGS flag, unsigned long *bits)

Loading…
Peruuta
Tallenna