linux-hams.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ax25 fix char type assumption in ax25_digi structure
@ 2005-10-03  3:51 Bob Brose N0QBJ
  2005-10-03 13:58 ` Ralf Baechle DL5RB
  0 siblings, 1 reply; 3+ messages in thread
From: Bob Brose N0QBJ @ 2005-10-03  3:51 UTC (permalink / raw)
  To: linux-hams

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...

--- linux/include/net/ax25.h.orig	2005-10-02 13:20:06.000000000 -0500
+++ linux/include/net/ax25.h	2005-10-02 13:20:37.000000000 -0500
@@ -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 {

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

* Re: [PATCH] ax25 fix char type assumption in ax25_digi structure
  2005-10-03  3:51 [PATCH] ax25 fix char type assumption in ax25_digi structure Bob Brose N0QBJ
@ 2005-10-03 13:58 ` Ralf Baechle DL5RB
  0 siblings, 0 replies; 3+ messages in thread
From: Ralf Baechle DL5RB @ 2005-10-03 13:58 UTC (permalink / raw)
  To: Bob Brose N0QBJ; +Cc: linux-hams

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

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

* Re: [PATCH] ax25 fix char type assumption in ax25_digi structure
@ 2005-11-02  5:30 Bob Brose N0QBJ
  0 siblings, 0 replies; 3+ messages in thread
From: Bob Brose N0QBJ @ 2005-11-02  5:30 UTC (permalink / raw)
  To: linux-hams

Ralf said:
> FYI, your patch is on the way to Linus and will hopefully make it into
> 2.6.14.  It turned out that this bug did actually exist since day one
> of the AX.25 history, that is it's present in 2.2 and 2.4 as well.

Thanks!
 
> Took me a little while to figure out why 2.4 was ever working for you;
> the reason is that PPC in 2.2 and PPC and PPC64 in 2.4 compile the
> kernel with -fsigned-char but no longer in 2.6.

Great detective work. It was amusing to see my coworkers try to find
a copy of K&R to look up the proper behavior.
 
> Thanks for tracking this one down!

Thanks very much to you for working on the ax25 code. It's good 
to know someone is maintaining and repairing it. It was starting
to seem pretty marginal...

73,
Bob

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

end of thread, other threads:[~2005-11-02  5:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-03  3:51 [PATCH] ax25 fix char type assumption in ax25_digi structure Bob Brose N0QBJ
2005-10-03 13:58 ` Ralf Baechle DL5RB
  -- strict thread matches above, loose matches on Subject: below --
2005-11-02  5:30 Bob Brose N0QBJ

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).