aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25/ax25_addr.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2005-09-08 16:40:41 -0400
committerDavid S. Miller <davem@davemloft.net>2005-09-08 16:40:41 -0400
commitbaed16a7ff5194487764db300c2753ac7409c4c5 (patch)
treea6cc8276bdd41abee85df26a894980a4de5d504c /net/ax25/ax25_addr.c
parent3a93481589dc80d9ff9082731f35031b0345442e (diff)
[AX.25]: Make asc2ax() thread-proof
Asc2ax was still using a static buffer for all invocations which isn't exactly SMP-safe. Change asc2ax to take an additional result buffer as the argument. Change all callers to provide such a buffer. This one only really is a fix for ROSE and as per recent discussions there's still much more to fix in ROSE ... Signed-off-by: Ralf Baechle DL5RB <ralf@linux-mips.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ax25/ax25_addr.c')
-rw-r--r--net/ax25/ax25_addr.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/net/ax25/ax25_addr.c b/net/ax25/ax25_addr.c
index dca179daf415..0164a155b8c4 100644
--- a/net/ax25/ax25_addr.c
+++ b/net/ax25/ax25_addr.c
@@ -67,37 +67,34 @@ char *ax2asc(char *buf, ax25_address *a)
67/* 67/*
68 * ascii -> ax25 conversion 68 * ascii -> ax25 conversion
69 */ 69 */
70ax25_address *asc2ax(char *callsign) 70void asc2ax(ax25_address *addr, char *callsign)
71{ 71{
72 static ax25_address addr;
73 char *s; 72 char *s;
74 int n; 73 int n;
75 74
76 for (s = callsign, n = 0; n < 6; n++) { 75 for (s = callsign, n = 0; n < 6; n++) {
77 if (*s != '\0' && *s != '-') 76 if (*s != '\0' && *s != '-')
78 addr.ax25_call[n] = *s++; 77 addr->ax25_call[n] = *s++;
79 else 78 else
80 addr.ax25_call[n] = ' '; 79 addr->ax25_call[n] = ' ';
81 addr.ax25_call[n] <<= 1; 80 addr->ax25_call[n] <<= 1;
82 addr.ax25_call[n] &= 0xFE; 81 addr->ax25_call[n] &= 0xFE;
83 } 82 }
84 83
85 if (*s++ == '\0') { 84 if (*s++ == '\0') {
86 addr.ax25_call[6] = 0x00; 85 addr->ax25_call[6] = 0x00;
87 return &addr; 86 return;
88 } 87 }
89 88
90 addr.ax25_call[6] = *s++ - '0'; 89 addr->ax25_call[6] = *s++ - '0';
91 90
92 if (*s != '\0') { 91 if (*s != '\0') {
93 addr.ax25_call[6] *= 10; 92 addr->ax25_call[6] *= 10;
94 addr.ax25_call[6] += *s++ - '0'; 93 addr->ax25_call[6] += *s++ - '0';
95 } 94 }
96 95
97 addr.ax25_call[6] <<= 1; 96 addr->ax25_call[6] <<= 1;
98 addr.ax25_call[6] &= 0x1E; 97 addr->ax25_call[6] &= 0x1E;
99
100 return &addr;
101} 98}
102 99
103/* 100/*