diff options
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/bcast.c | 6 | ||||
-rw-r--r-- | net/tipc/config.c | 32 | ||||
-rw-r--r-- | net/tipc/dbg.c | 3 | ||||
-rw-r--r-- | net/tipc/name_distr.c | 10 | ||||
-rw-r--r-- | net/tipc/node.c | 12 | ||||
-rw-r--r-- | net/tipc/subscr.c | 3 |
6 files changed, 24 insertions, 42 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 1bb75703f384..730c5c47ed8d 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -774,8 +774,8 @@ int tipc_bclink_set_queue_limits(u32 limit) | |||
774 | 774 | ||
775 | int tipc_bclink_init(void) | 775 | int tipc_bclink_init(void) |
776 | { | 776 | { |
777 | bcbearer = kmalloc(sizeof(*bcbearer), GFP_ATOMIC); | 777 | bcbearer = kzalloc(sizeof(*bcbearer), GFP_ATOMIC); |
778 | bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC); | 778 | bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC); |
779 | if (!bcbearer || !bclink) { | 779 | if (!bcbearer || !bclink) { |
780 | nomem: | 780 | nomem: |
781 | warn("Multicast link creation failed, no memory\n"); | 781 | warn("Multicast link creation failed, no memory\n"); |
@@ -786,14 +786,12 @@ int tipc_bclink_init(void) | |||
786 | return -ENOMEM; | 786 | return -ENOMEM; |
787 | } | 787 | } |
788 | 788 | ||
789 | memset(bcbearer, 0, sizeof(struct bcbearer)); | ||
790 | INIT_LIST_HEAD(&bcbearer->bearer.cong_links); | 789 | INIT_LIST_HEAD(&bcbearer->bearer.cong_links); |
791 | bcbearer->bearer.media = &bcbearer->media; | 790 | bcbearer->bearer.media = &bcbearer->media; |
792 | bcbearer->media.send_msg = tipc_bcbearer_send; | 791 | bcbearer->media.send_msg = tipc_bcbearer_send; |
793 | sprintf(bcbearer->media.name, "tipc-multicast"); | 792 | sprintf(bcbearer->media.name, "tipc-multicast"); |
794 | 793 | ||
795 | bcl = &bclink->link; | 794 | bcl = &bclink->link; |
796 | memset(bclink, 0, sizeof(struct bclink)); | ||
797 | INIT_LIST_HEAD(&bcl->waiting_ports); | 795 | INIT_LIST_HEAD(&bcl->waiting_ports); |
798 | bcl->next_out_no = 1; | 796 | bcl->next_out_no = 1; |
799 | spin_lock_init(&bclink->node.lock); | 797 | spin_lock_init(&bclink->node.lock); |
diff --git a/net/tipc/config.c b/net/tipc/config.c index ed1351ed05e1..458a2c46cef3 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
@@ -107,7 +107,7 @@ int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, | |||
107 | struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value) | 107 | struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value) |
108 | { | 108 | { |
109 | struct sk_buff *buf; | 109 | struct sk_buff *buf; |
110 | u32 value_net; | 110 | __be32 value_net; |
111 | 111 | ||
112 | buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value))); | 112 | buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value))); |
113 | if (buf) { | 113 | if (buf) { |
@@ -284,8 +284,7 @@ static struct sk_buff *cfg_set_own_addr(void) | |||
284 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) | 284 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
285 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 285 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
286 | 286 | ||
287 | addr = *(u32 *)TLV_DATA(req_tlv_area); | 287 | addr = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
288 | addr = ntohl(addr); | ||
289 | if (addr == tipc_own_addr) | 288 | if (addr == tipc_own_addr) |
290 | return tipc_cfg_reply_none(); | 289 | return tipc_cfg_reply_none(); |
291 | if (!tipc_addr_node_valid(addr)) | 290 | if (!tipc_addr_node_valid(addr)) |
@@ -319,8 +318,7 @@ static struct sk_buff *cfg_set_remote_mng(void) | |||
319 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 318 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
320 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 319 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
321 | 320 | ||
322 | value = *(u32 *)TLV_DATA(req_tlv_area); | 321 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
323 | value = ntohl(value); | ||
324 | tipc_remote_management = (value != 0); | 322 | tipc_remote_management = (value != 0); |
325 | return tipc_cfg_reply_none(); | 323 | return tipc_cfg_reply_none(); |
326 | } | 324 | } |
@@ -332,8 +330,7 @@ static struct sk_buff *cfg_set_max_publications(void) | |||
332 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 330 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
333 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 331 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
334 | 332 | ||
335 | value = *(u32 *)TLV_DATA(req_tlv_area); | 333 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
336 | value = ntohl(value); | ||
337 | if (value != delimit(value, 1, 65535)) | 334 | if (value != delimit(value, 1, 65535)) |
338 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 335 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
339 | " (max publications must be 1-65535)"); | 336 | " (max publications must be 1-65535)"); |
@@ -348,8 +345,7 @@ static struct sk_buff *cfg_set_max_subscriptions(void) | |||
348 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 345 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
349 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 346 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
350 | 347 | ||
351 | value = *(u32 *)TLV_DATA(req_tlv_area); | 348 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
352 | value = ntohl(value); | ||
353 | if (value != delimit(value, 1, 65535)) | 349 | if (value != delimit(value, 1, 65535)) |
354 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 350 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
355 | " (max subscriptions must be 1-65535"); | 351 | " (max subscriptions must be 1-65535"); |
@@ -363,8 +359,7 @@ static struct sk_buff *cfg_set_max_ports(void) | |||
363 | 359 | ||
364 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 360 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
365 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 361 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
366 | value = *(u32 *)TLV_DATA(req_tlv_area); | 362 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
367 | value = ntohl(value); | ||
368 | if (value == tipc_max_ports) | 363 | if (value == tipc_max_ports) |
369 | return tipc_cfg_reply_none(); | 364 | return tipc_cfg_reply_none(); |
370 | if (value != delimit(value, 127, 65535)) | 365 | if (value != delimit(value, 127, 65535)) |
@@ -383,8 +378,7 @@ static struct sk_buff *cfg_set_max_zones(void) | |||
383 | 378 | ||
384 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 379 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
385 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 380 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
386 | value = *(u32 *)TLV_DATA(req_tlv_area); | 381 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
387 | value = ntohl(value); | ||
388 | if (value == tipc_max_zones) | 382 | if (value == tipc_max_zones) |
389 | return tipc_cfg_reply_none(); | 383 | return tipc_cfg_reply_none(); |
390 | if (value != delimit(value, 1, 255)) | 384 | if (value != delimit(value, 1, 255)) |
@@ -403,8 +397,7 @@ static struct sk_buff *cfg_set_max_clusters(void) | |||
403 | 397 | ||
404 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 398 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
405 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 399 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
406 | value = *(u32 *)TLV_DATA(req_tlv_area); | 400 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
407 | value = ntohl(value); | ||
408 | if (value != delimit(value, 1, 1)) | 401 | if (value != delimit(value, 1, 1)) |
409 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 402 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
410 | " (max clusters fixed at 1)"); | 403 | " (max clusters fixed at 1)"); |
@@ -417,8 +410,7 @@ static struct sk_buff *cfg_set_max_nodes(void) | |||
417 | 410 | ||
418 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 411 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
419 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 412 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
420 | value = *(u32 *)TLV_DATA(req_tlv_area); | 413 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
421 | value = ntohl(value); | ||
422 | if (value == tipc_max_nodes) | 414 | if (value == tipc_max_nodes) |
423 | return tipc_cfg_reply_none(); | 415 | return tipc_cfg_reply_none(); |
424 | if (value != delimit(value, 8, 2047)) | 416 | if (value != delimit(value, 8, 2047)) |
@@ -437,8 +429,7 @@ static struct sk_buff *cfg_set_max_slaves(void) | |||
437 | 429 | ||
438 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 430 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
439 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 431 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
440 | value = *(u32 *)TLV_DATA(req_tlv_area); | 432 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
441 | value = ntohl(value); | ||
442 | if (value != 0) | 433 | if (value != 0) |
443 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | 434 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED |
444 | " (max secondary nodes fixed at 0)"); | 435 | " (max secondary nodes fixed at 0)"); |
@@ -451,8 +442,7 @@ static struct sk_buff *cfg_set_netid(void) | |||
451 | 442 | ||
452 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 443 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
453 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 444 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
454 | value = *(u32 *)TLV_DATA(req_tlv_area); | 445 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
455 | value = ntohl(value); | ||
456 | if (value == tipc_net_id) | 446 | if (value == tipc_net_id) |
457 | return tipc_cfg_reply_none(); | 447 | return tipc_cfg_reply_none(); |
458 | if (value != delimit(value, 1, 9999)) | 448 | if (value != delimit(value, 1, 9999)) |
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c index d8af4c28695d..627f99b7afdf 100644 --- a/net/tipc/dbg.c +++ b/net/tipc/dbg.c | |||
@@ -393,8 +393,7 @@ struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space) | |||
393 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | 393 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) |
394 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 394 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
395 | 395 | ||
396 | value = *(u32 *)TLV_DATA(req_tlv_area); | 396 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
397 | value = ntohl(value); | ||
398 | if (value != delimit(value, 0, 32768)) | 397 | if (value != delimit(value, 0, 32768)) |
399 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 398 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
400 | " (log size must be 0-32768)"); | 399 | " (log size must be 0-32768)"); |
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 03bd659c43ca..7bf87cb26ef3 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
@@ -66,11 +66,11 @@ | |||
66 | */ | 66 | */ |
67 | 67 | ||
68 | struct distr_item { | 68 | struct distr_item { |
69 | u32 type; | 69 | __be32 type; |
70 | u32 lower; | 70 | __be32 lower; |
71 | u32 upper; | 71 | __be32 upper; |
72 | u32 ref; | 72 | __be32 ref; |
73 | u32 key; | 73 | __be32 key; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | /** | 76 | /** |
diff --git a/net/tipc/node.c b/net/tipc/node.c index 886bda5e88db..4111a31def79 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -60,7 +60,7 @@ struct node *tipc_node_create(u32 addr) | |||
60 | struct node *n_ptr; | 60 | struct node *n_ptr; |
61 | struct node **curr_node; | 61 | struct node **curr_node; |
62 | 62 | ||
63 | n_ptr = kmalloc(sizeof(*n_ptr),GFP_ATOMIC); | 63 | n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC); |
64 | if (!n_ptr) { | 64 | if (!n_ptr) { |
65 | warn("Node creation failed, no memory\n"); | 65 | warn("Node creation failed, no memory\n"); |
66 | return NULL; | 66 | return NULL; |
@@ -75,7 +75,6 @@ struct node *tipc_node_create(u32 addr) | |||
75 | return NULL; | 75 | return NULL; |
76 | } | 76 | } |
77 | 77 | ||
78 | memset(n_ptr, 0, sizeof(*n_ptr)); | ||
79 | n_ptr->addr = addr; | 78 | n_ptr->addr = addr; |
80 | spin_lock_init(&n_ptr->lock); | 79 | spin_lock_init(&n_ptr->lock); |
81 | INIT_LIST_HEAD(&n_ptr->nsub); | 80 | INIT_LIST_HEAD(&n_ptr->nsub); |
@@ -597,8 +596,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) | |||
597 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) | 596 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
598 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 597 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
599 | 598 | ||
600 | domain = *(u32 *)TLV_DATA(req_tlv_area); | 599 | domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
601 | domain = ntohl(domain); | ||
602 | if (!tipc_addr_domain_valid(domain)) | 600 | if (!tipc_addr_domain_valid(domain)) |
603 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 601 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
604 | " (network address)"); | 602 | " (network address)"); |
@@ -642,8 +640,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) | |||
642 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) | 640 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
643 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 641 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
644 | 642 | ||
645 | domain = *(u32 *)TLV_DATA(req_tlv_area); | 643 | domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
646 | domain = ntohl(domain); | ||
647 | if (!tipc_addr_domain_valid(domain)) | 644 | if (!tipc_addr_domain_valid(domain)) |
648 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 645 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
649 | " (network address)"); | 646 | " (network address)"); |
@@ -664,8 +661,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) | |||
664 | 661 | ||
665 | /* Add TLV for broadcast link */ | 662 | /* Add TLV for broadcast link */ |
666 | 663 | ||
667 | link_info.dest = tipc_own_addr & 0xfffff00; | 664 | link_info.dest = htonl(tipc_own_addr & 0xfffff00); |
668 | link_info.dest = htonl(link_info.dest); | ||
669 | link_info.up = htonl(1); | 665 | link_info.up = htonl(1); |
670 | sprintf(link_info.str, tipc_bclink_name); | 666 | sprintf(link_info.str, tipc_bclink_name); |
671 | tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); | 667 | tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); |
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index 7a918f12a5df..ddade7388aa0 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
@@ -350,7 +350,7 @@ static void subscr_subscribe(struct tipc_subscr *s, | |||
350 | 350 | ||
351 | /* Allocate subscription object */ | 351 | /* Allocate subscription object */ |
352 | 352 | ||
353 | sub = kmalloc(sizeof(*sub), GFP_ATOMIC); | 353 | sub = kzalloc(sizeof(*sub), GFP_ATOMIC); |
354 | if (!sub) { | 354 | if (!sub) { |
355 | warn("Subscription rejected, no memory\n"); | 355 | warn("Subscription rejected, no memory\n"); |
356 | subscr_terminate(subscriber); | 356 | subscr_terminate(subscriber); |
@@ -359,7 +359,6 @@ static void subscr_subscribe(struct tipc_subscr *s, | |||
359 | 359 | ||
360 | /* Initialize subscription object */ | 360 | /* Initialize subscription object */ |
361 | 361 | ||
362 | memset(sub, 0, sizeof(*sub)); | ||
363 | sub->seq.type = htohl(s->seq.type, subscriber->swap); | 362 | sub->seq.type = htohl(s->seq.type, subscriber->swap); |
364 | sub->seq.lower = htohl(s->seq.lower, subscriber->swap); | 363 | sub->seq.lower = htohl(s->seq.lower, subscriber->swap); |
365 | sub->seq.upper = htohl(s->seq.upper, subscriber->swap); | 364 | sub->seq.upper = htohl(s->seq.upper, subscriber->swap); |