Skip to content

Commit

Permalink
net: coap: Fix coverity issue
Browse files Browse the repository at this point in the history
To get u8_t value, just right shift the operands are enough.

Fixes zephyrproject-rtos#12298
Coverity-CID: 190635

Signed-off-by: Ravi kumar Veeramally <[email protected]>
  • Loading branch information
rveerama1 authored and nashif committed Feb 27, 2019
1 parent 46298da commit f940cec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/net/lib/coap/coap_link_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static inline bool append_be16(struct coap_packet *cpkt, u16_t data)
return false;
}

cpkt->data[cpkt->offset++] = (data & 0xFF) >> 8;
cpkt->data[cpkt->offset++] = data >> 8;
cpkt->data[cpkt->offset++] = (u8_t) data;

return true;
Expand Down

0 comments on commit f940cec

Please sign in to comment.