Skip to contentSkip to conversation

ax25 fix char type assumption in ax25_digi structure

PATCH In review Bob Brose N0QBJ 2 participants 2 messages Oct 3, 2005 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ax25 fix char type assumption in ax25_digi structure

This trivial fix allows ax25 IP to work on the PPC architecture. The patch is against 2.6.14-rc1 and works with a offset against 2.6.14-rc3 as well.

If not explicitly declared, PPC assumes chars are unsigned. x86 assumes they are signed. The code in ax25_addr.c uses -1 with char lastrepeat in the ax25_digi struct which fails later comparisons to -1 on PPC. Explicitly declaring the char as signed char fixes the problem.

If someone could direct this upstream it would be nice...

include/net/ax25.h renamed from include/net/ax25.h.orig +1 -1
@@ -171,7 +171,7 @@
 	ax25_address		calls[AX25_MAX_DIGIS];
 	unsigned char		repeated[AX25_MAX_DIGIS];
 	unsigned char		ndigi;
-	char			lastrepeat;
+	signed char		lastrepeat;
 } ax25_digi;
 
 typedef struct ax25_route {
#1 lore raw
Quoted 9 lines · On Mon, Oct 03, 2005 at 03:51:20AM -0000, Bob Brose N0QBJ wrote:

This trivial fix allows ax25 IP to work on the PPC architecture. The patch is against 2.6.14-rc1 and works with a offset against 2.6.14-rc3 as well.

If not explicitly declared, PPC assumes chars are unsigned. x86 assumes they are signed. The code in ax25_addr.c uses -1 with char lastrepeat in the ax25_digi struct which fails later comparisons to -1 on PPC. Explicitly declaring the char as signed char fixes the problem.

I'll take care of your patch.

Ralf