Skip to content

Commit

Permalink
gnrc_sixlowpan_iphc: fix last byte of iphc_hdr always being 0
Browse files Browse the repository at this point in the history
Coverty scan found this:

> CID 298295 (RIOT-OS#1 of 1): Operands don't affect result (CONSTANT_EXPRESSION_RESULT) result_independent_of_operands:
> (ipv6_hdr_get_fl(ipv6_hdr) & 255) >> 8 is 0 regardless of the values of its operands.

Looking at the code, this appears to be a copy & paste error from the previous line.
  • Loading branch information
benpicco committed Aug 11, 2020
1 parent a9a0671 commit 2ed7f66
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1033,9 +1033,9 @@ static size_t _iphc_ipv6_encode(gnrc_pktsnip_t *pkt,
iphc_hdr[inline_pos++] = (uint8_t)((ipv6_hdr_get_fl(ipv6_hdr) & 0x000f0000) >> 16);
}

/* copy remaining byteos of flow label */
/* copy remaining bytes of flow label */
iphc_hdr[inline_pos++] = (uint8_t)((ipv6_hdr_get_fl(ipv6_hdr) & 0x0000ff00) >> 8);
iphc_hdr[inline_pos++] = (uint8_t)((ipv6_hdr_get_fl(ipv6_hdr) & 0x000000ff) >> 8);
iphc_hdr[inline_pos++] = (uint8_t)(ipv6_hdr_get_fl(ipv6_hdr) & 0x000000ff);
}

/* check for compressible next header */
Expand Down

0 comments on commit 2ed7f66

Please sign in to comment.