Sonarcloud (wrongly?) claims that the a struct has padding and memcmp should not be used

I get a bug report from sonarcloud stating that the memcmp operation should not be used when comparing two structs as the struct has padding. Here is the link to the bug report → https://sonarcloud.io/project/issues?resolved=false&rules=c%3AS5000&severities=BLOCKER&types=BUG&id=balaji-nordic_sdk-nrf&open=AYTON6R0KjB6nK53VS7b

The structure in question is bt_addr_le_t defined here .
AFAIK, the struct does not have padding. I verified that by printing the size of the struct. Should I just mark it as false positive? Or am I missing something?

Hello @forkbeard,

Thank you for the report!
Indeed, that is a false positive that I could successfully reproduce. I have created a ticket to fix it: CPP-3978.

Have a nice day,
Amélie

Thanks @Amelie

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.