diff options
author | Dave Jones <davej@redhat.com> | 2006-12-12 17:41:41 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-12-12 17:41:41 -0500 |
commit | c4366889dda8110247be59ca41fddb82951a8c26 (patch) | |
tree | 705c1a996bed8fd48ce94ff33ec9fd00f9b94875 /net/ax25 | |
parent | db2fb9db5735cc532fd4fc55e94b9a3c3750378e (diff) | |
parent | e1036502e5263851259d147771226161e5ccc85a (diff) |
Merge ../linus
Conflicts:
drivers/cpufreq/cpufreq.c
Diffstat (limited to 'net/ax25')
-rw-r--r-- | net/ax25/af_ax25.c | 6 | ||||
-rw-r--r-- | net/ax25/ax25_addr.c | 36 | ||||
-rw-r--r-- | net/ax25/ax25_out.c | 4 | ||||
-rw-r--r-- | net/ax25/ax25_route.c | 5 | ||||
-rw-r--r-- | net/ax25/sysctl_net_ax25.c | 5 |
5 files changed, 35 insertions, 21 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 000695c485..6cabf6d8a7 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -906,13 +906,13 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) | |||
906 | ax25->source_addr = oax25->source_addr; | 906 | ax25->source_addr = oax25->source_addr; |
907 | 907 | ||
908 | if (oax25->digipeat != NULL) { | 908 | if (oax25->digipeat != NULL) { |
909 | if ((ax25->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { | 909 | ax25->digipeat = kmemdup(oax25->digipeat, sizeof(ax25_digi), |
910 | GFP_ATOMIC); | ||
911 | if (ax25->digipeat == NULL) { | ||
910 | sk_free(sk); | 912 | sk_free(sk); |
911 | ax25_cb_put(ax25); | 913 | ax25_cb_put(ax25); |
912 | return NULL; | 914 | return NULL; |
913 | } | 915 | } |
914 | |||
915 | memcpy(ax25->digipeat, oax25->digipeat, sizeof(ax25_digi)); | ||
916 | } | 916 | } |
917 | 917 | ||
918 | sk->sk_protinfo = ax25; | 918 | sk->sk_protinfo = ax25; |
diff --git a/net/ax25/ax25_addr.c b/net/ax25/ax25_addr.c index 5f0896ad00..97a49c79c6 100644 --- a/net/ax25/ax25_addr.c +++ b/net/ax25/ax25_addr.c | |||
@@ -29,17 +29,26 @@ | |||
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * The null address is defined as a callsign of all spaces with an | 32 | * The default broadcast address of an interface is QST-0; the default address |
33 | * SSID of zero. | 33 | * is LINUX-1. The null address is defined as a callsign of all spaces with |
34 | * an SSID of zero. | ||
34 | */ | 35 | */ |
35 | ax25_address null_ax25_address = {{0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00}}; | ||
36 | 36 | ||
37 | const ax25_address ax25_bcast = | ||
38 | {{'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, 0 << 1}}; | ||
39 | const ax25_address ax25_defaddr = | ||
40 | {{'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1, 1 << 1}}; | ||
41 | const ax25_address null_ax25_address = | ||
42 | {{' ' << 1, ' ' << 1, ' ' << 1, ' ' << 1, ' ' << 1, ' ' << 1, 0 << 1}}; | ||
43 | |||
44 | EXPORT_SYMBOL_GPL(ax25_bcast); | ||
45 | EXPORT_SYMBOL_GPL(ax25_defaddr); | ||
37 | EXPORT_SYMBOL(null_ax25_address); | 46 | EXPORT_SYMBOL(null_ax25_address); |
38 | 47 | ||
39 | /* | 48 | /* |
40 | * ax25 -> ascii conversion | 49 | * ax25 -> ascii conversion |
41 | */ | 50 | */ |
42 | char *ax2asc(char *buf, ax25_address *a) | 51 | char *ax2asc(char *buf, const ax25_address *a) |
43 | { | 52 | { |
44 | char c, *s; | 53 | char c, *s; |
45 | int n; | 54 | int n; |
@@ -72,9 +81,9 @@ EXPORT_SYMBOL(ax2asc); | |||
72 | /* | 81 | /* |
73 | * ascii -> ax25 conversion | 82 | * ascii -> ax25 conversion |
74 | */ | 83 | */ |
75 | void asc2ax(ax25_address *addr, char *callsign) | 84 | void asc2ax(ax25_address *addr, const char *callsign) |
76 | { | 85 | { |
77 | char *s; | 86 | const char *s; |
78 | int n; | 87 | int n; |
79 | 88 | ||
80 | for (s = callsign, n = 0; n < 6; n++) { | 89 | for (s = callsign, n = 0; n < 6; n++) { |
@@ -107,7 +116,7 @@ EXPORT_SYMBOL(asc2ax); | |||
107 | /* | 116 | /* |
108 | * Compare two ax.25 addresses | 117 | * Compare two ax.25 addresses |
109 | */ | 118 | */ |
110 | int ax25cmp(ax25_address *a, ax25_address *b) | 119 | int ax25cmp(const ax25_address *a, const ax25_address *b) |
111 | { | 120 | { |
112 | int ct = 0; | 121 | int ct = 0; |
113 | 122 | ||
@@ -128,7 +137,7 @@ EXPORT_SYMBOL(ax25cmp); | |||
128 | /* | 137 | /* |
129 | * Compare two AX.25 digipeater paths. | 138 | * Compare two AX.25 digipeater paths. |
130 | */ | 139 | */ |
131 | int ax25digicmp(ax25_digi *digi1, ax25_digi *digi2) | 140 | int ax25digicmp(const ax25_digi *digi1, const ax25_digi *digi2) |
132 | { | 141 | { |
133 | int i; | 142 | int i; |
134 | 143 | ||
@@ -149,7 +158,9 @@ int ax25digicmp(ax25_digi *digi1, ax25_digi *digi2) | |||
149 | * Given an AX.25 address pull of to, from, digi list, command/response and the start of data | 158 | * Given an AX.25 address pull of to, from, digi list, command/response and the start of data |
150 | * | 159 | * |
151 | */ | 160 | */ |
152 | unsigned char *ax25_addr_parse(unsigned char *buf, int len, ax25_address *src, ax25_address *dest, ax25_digi *digi, int *flags, int *dama) | 161 | const unsigned char *ax25_addr_parse(const unsigned char *buf, int len, |
162 | ax25_address *src, ax25_address *dest, ax25_digi *digi, int *flags, | ||
163 | int *dama) | ||
153 | { | 164 | { |
154 | int d = 0; | 165 | int d = 0; |
155 | 166 | ||
@@ -204,7 +215,8 @@ unsigned char *ax25_addr_parse(unsigned char *buf, int len, ax25_address *src, a | |||
204 | /* | 215 | /* |
205 | * Assemble an AX.25 header from the bits | 216 | * Assemble an AX.25 header from the bits |
206 | */ | 217 | */ |
207 | int ax25_addr_build(unsigned char *buf, ax25_address *src, ax25_address *dest, ax25_digi *d, int flag, int modulus) | 218 | int ax25_addr_build(unsigned char *buf, const ax25_address *src, |
219 | const ax25_address *dest, const ax25_digi *d, int flag, int modulus) | ||
208 | { | 220 | { |
209 | int len = 0; | 221 | int len = 0; |
210 | int ct = 0; | 222 | int ct = 0; |
@@ -261,7 +273,7 @@ int ax25_addr_build(unsigned char *buf, ax25_address *src, ax25_address *dest, a | |||
261 | return len; | 273 | return len; |
262 | } | 274 | } |
263 | 275 | ||
264 | int ax25_addr_size(ax25_digi *dp) | 276 | int ax25_addr_size(const ax25_digi *dp) |
265 | { | 277 | { |
266 | if (dp == NULL) | 278 | if (dp == NULL) |
267 | return 2 * AX25_ADDR_LEN; | 279 | return 2 * AX25_ADDR_LEN; |
@@ -272,7 +284,7 @@ int ax25_addr_size(ax25_digi *dp) | |||
272 | /* | 284 | /* |
273 | * Reverse Digipeat List. May not pass both parameters as same struct | 285 | * Reverse Digipeat List. May not pass both parameters as same struct |
274 | */ | 286 | */ |
275 | void ax25_digi_invert(ax25_digi *in, ax25_digi *out) | 287 | void ax25_digi_invert(const ax25_digi *in, ax25_digi *out) |
276 | { | 288 | { |
277 | int ct; | 289 | int ct; |
278 | 290 | ||
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c index d7736e5853..f84047d1e8 100644 --- a/net/ax25/ax25_out.c +++ b/net/ax25/ax25_out.c | |||
@@ -70,11 +70,11 @@ ax25_cb *ax25_send_frame(struct sk_buff *skb, int paclen, ax25_address *src, ax2 | |||
70 | ax25->dest_addr = *dest; | 70 | ax25->dest_addr = *dest; |
71 | 71 | ||
72 | if (digi != NULL) { | 72 | if (digi != NULL) { |
73 | if ((ax25->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { | 73 | ax25->digipeat = kmemdup(digi, sizeof(*digi), GFP_ATOMIC); |
74 | if (ax25->digipeat == NULL) { | ||
74 | ax25_cb_put(ax25); | 75 | ax25_cb_put(ax25); |
75 | return NULL; | 76 | return NULL; |
76 | } | 77 | } |
77 | memcpy(ax25->digipeat, digi, sizeof(ax25_digi)); | ||
78 | } | 78 | } |
79 | 79 | ||
80 | switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { | 80 | switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { |
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c index 51b7bdaf27..8580356ace 100644 --- a/net/ax25/ax25_route.c +++ b/net/ax25/ax25_route.c | |||
@@ -432,11 +432,12 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr) | |||
432 | } | 432 | } |
433 | 433 | ||
434 | if (ax25_rt->digipeat != NULL) { | 434 | if (ax25_rt->digipeat != NULL) { |
435 | if ((ax25->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { | 435 | ax25->digipeat = kmemdup(ax25_rt->digipeat, sizeof(ax25_digi), |
436 | GFP_ATOMIC); | ||
437 | if (ax25->digipeat == NULL) { | ||
436 | err = -ENOMEM; | 438 | err = -ENOMEM; |
437 | goto put; | 439 | goto put; |
438 | } | 440 | } |
439 | memcpy(ax25->digipeat, ax25_rt->digipeat, sizeof(ax25_digi)); | ||
440 | ax25_adjust_path(addr, ax25->digipeat); | 441 | ax25_adjust_path(addr, ax25->digipeat); |
441 | } | 442 | } |
442 | 443 | ||
diff --git a/net/ax25/sysctl_net_ax25.c b/net/ax25/sysctl_net_ax25.c index 867d425379..d23a27f25d 100644 --- a/net/ax25/sysctl_net_ax25.c +++ b/net/ax25/sysctl_net_ax25.c | |||
@@ -209,7 +209,9 @@ void ax25_register_sysctl(void) | |||
209 | } | 209 | } |
210 | 210 | ||
211 | for (n = 0, ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next) { | 211 | for (n = 0, ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next) { |
212 | ctl_table *child = kmalloc(sizeof(ax25_param_table), GFP_ATOMIC); | 212 | struct ctl_table *child = kmemdup(ax25_param_table, |
213 | sizeof(ax25_param_table), | ||
214 | GFP_ATOMIC); | ||
213 | if (!child) { | 215 | if (!child) { |
214 | while (n--) | 216 | while (n--) |
215 | kfree(ax25_table[n].child); | 217 | kfree(ax25_table[n].child); |
@@ -217,7 +219,6 @@ void ax25_register_sysctl(void) | |||
217 | spin_unlock_bh(&ax25_dev_lock); | 219 | spin_unlock_bh(&ax25_dev_lock); |
218 | return; | 220 | return; |
219 | } | 221 | } |
220 | memcpy(child, ax25_param_table, sizeof(ax25_param_table)); | ||
221 | ax25_table[n].child = ax25_dev->systable = child; | 222 | ax25_table[n].child = ax25_dev->systable = child; |
222 | ax25_table[n].ctl_name = n + 1; | 223 | ax25_table[n].ctl_name = n + 1; |
223 | ax25_table[n].procname = ax25_dev->dev->name; | 224 | ax25_table[n].procname = ax25_dev->dev->name; |