diff options
author | Sven Eckelmann <sven@narfation.org> | 2011-05-14 17:14:49 -0400 |
---|---|---|
committer | Sven Eckelmann <sven@narfation.org> | 2011-05-30 01:39:30 -0400 |
commit | 38e3c5f0dae7a3bbb32c3b2bb28c3f2557d40fe9 (patch) | |
tree | f0a64eaf3709c5ca1455a1c66ce0a9c22c5c4961 /net/batman-adv/originator.c | |
parent | 16f14b45c48f4f1be5857103ee3054114604d98c (diff) |
batman-adv: Don't do pointer arithmetic with void*
The size of void is currently set by gcc to 1, but is not well defined
in general. Therefore it is more advisable to cast it to char* before
doing pointer arithmetic.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/originator.c')
-rw-r--r-- | net/batman-adv/originator.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 40a30bbcd147..ae54f77f2c1b 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -559,7 +559,7 @@ static int orig_node_del_if(struct orig_node *orig_node, | |||
559 | memcpy(data_ptr, orig_node->bcast_own, del_if_num * chunk_size); | 559 | memcpy(data_ptr, orig_node->bcast_own, del_if_num * chunk_size); |
560 | 560 | ||
561 | /* copy second part */ | 561 | /* copy second part */ |
562 | memcpy(data_ptr + del_if_num * chunk_size, | 562 | memcpy((char *)data_ptr + del_if_num * chunk_size, |
563 | orig_node->bcast_own + ((del_if_num + 1) * chunk_size), | 563 | orig_node->bcast_own + ((del_if_num + 1) * chunk_size), |
564 | (max_if_num - del_if_num) * chunk_size); | 564 | (max_if_num - del_if_num) * chunk_size); |
565 | 565 | ||
@@ -579,7 +579,7 @@ free_bcast_own: | |||
579 | memcpy(data_ptr, orig_node->bcast_own_sum, | 579 | memcpy(data_ptr, orig_node->bcast_own_sum, |
580 | del_if_num * sizeof(uint8_t)); | 580 | del_if_num * sizeof(uint8_t)); |
581 | 581 | ||
582 | memcpy(data_ptr + del_if_num * sizeof(uint8_t), | 582 | memcpy((char *)data_ptr + del_if_num * sizeof(uint8_t), |
583 | orig_node->bcast_own_sum + ((del_if_num + 1) * sizeof(uint8_t)), | 583 | orig_node->bcast_own_sum + ((del_if_num + 1) * sizeof(uint8_t)), |
584 | (max_if_num - del_if_num) * sizeof(uint8_t)); | 584 | (max_if_num - del_if_num) * sizeof(uint8_t)); |
585 | 585 | ||