You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/02/13 08:08:46 UTC
[GitHub] [mynewt-core] kasjer commented on a change in pull request #2192:
Add generic API to retrieve provisioned data from BSP
kasjer commented on a change in pull request #2192: Add generic API to retrieve provisioned data from BSP
URL: https://github.com/apache/mynewt-core/pull/2192#discussion_r378695952
##########
File path: hw/mcu/nordic/nrf52xxx/src/nrf52_hw_id.c
##########
@@ -46,7 +50,20 @@ hal_bsp_hw_id(uint8_t *id, int max_len)
len = cnt;
cnt = min(sizeof(NRF_FICR->DEVICEADDR), max_len - len);
+ cnt = max(0, cnt);
Review comment:
Line 53 seems not to improve anything
line 48: cnt <= max_len
line 50: len = cnt, so: len <= max_len
line 52: max_len - len >= 0 so: cnt >= 0
hence line 53 is not needed if could be useful after line 48 in case max_len was negative to prevent damage in memcpy
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services