Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment annnotation in fr_value_box_init() (CID #1543214) #5185

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/lib/util/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,17 @@ extern fr_sbuff_parse_rules_t const *value_parse_rules_quoted_char[UINT8_MAX];
static inline CC_HINT(nonnull(1), always_inline)
void _fr_value_box_init(NDEBUG_LOCATION_ARGS fr_value_box_t *vb, fr_type_t type, fr_dict_attr_t const *enumv, bool tainted)
{
/*
* Initializes an fr_value_box_t pointed at by vb appropriately for a given type.
* Coverity gets involved here because an fr_value_box_t has members with const-
* qualified type (and members that have members with const-qualified type), so an
* attempt to assign to *vb or any of its cosnt-qualified members will give an error.
*
* C compilers, at least currently, let one get around the issue. See the memcpy()
* below. Coverity, though, isn't faked out, and reports the store_writes_const_field
* defect annotated here. Anything we do has to eventually assign to the whole of *vb
* and thus will raise the issue.
*/
/* coverity[store_writes_const_field] */
memcpy((void *) vb, &(fr_value_box_t){
.type = type,
Expand Down