Skip to content

Commit

Permalink
fix wrong sizeof() parameter
Browse files Browse the repository at this point in the history
    Coverity:

    CID 739610 (#1 of 1): Incorrect sizeof expression (BAD_SIZEOF)
    Taking the size of pointer parameter "lower_border_ip" is suspicious.

    CID 739611 (#1 of 1): Incorrect sizeof expression (BAD_SIZEOF)
    Taking the size of pointer parameter "upper_border_ip" is suspicious.

    CID 739692 (#1 of 2): Wrong sizeof argument (SIZEOF_MISMATCH)
    Passing argument "lower_border_ip" of type "union olsr_ip_addr *" and argument "8UL /* sizeof (lower_border_ip) */" to function "memset(void *, int, size_t)" is suspicious. Did you intend to use "sizeof(*lower_border_ip)" instead of "sizeof (lower_border_ip)" ?

    CID 739692 (#2 of 2): Wrong sizeof argument (SIZEOF_MISMATCH)
    Passing argument "upper_border_ip" of type "union olsr_ip_addr *" and argument "8UL /* sizeof (upper_border_ip) */" to function "memset(void *, int, size_t)" is suspicious. Did you intend to use "sizeof(*upper_border_ip)" instead of "sizeof (upper_border_ip)" ?

    Signed-off-by: Henning Rogge <[email protected]>
  • Loading branch information
HRogge committed Oct 22, 2012
1 parent 73cf8c1 commit 82a8656
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tc_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ olsr_calculate_tc_border(uint8_t lower_border, union olsr_ip_addr *lower_border_
return 0;
}
if (lower_border == 0xff) {
memset(lower_border_ip, 0, sizeof(lower_border_ip));
memset(lower_border_ip, 0, sizeof(*lower_border_ip));
} else {
int i;

Expand All @@ -738,7 +738,7 @@ olsr_calculate_tc_border(uint8_t lower_border, union olsr_ip_addr *lower_border_
}

if (upper_border == 0xff) {
memset(upper_border_ip, 0xff, sizeof(upper_border_ip));
memset(upper_border_ip, 0xff, sizeof(*upper_border_ip));
} else {
int i;

Expand Down

0 comments on commit 82a8656

Please sign in to comment.