HomeFreeBSD

MFC r325017: libnv: Fix strict-aliasing violation with cookie

Description

MFC r325017: libnv: Fix strict-aliasing violation with cookie

In r323851 (MFC'ed to stable/11 as r324831), some casts were adjusted in
calls to nvlist_next() and nvlist_get_pararr() in order to make scan-build
happy. I think these changes just confused scan-build into not reporting
the strict-aliasing violation.

For example, nvlist_xdescriptors() is causing nvlist_next() to write to its
local variable nvp of type nvpair_t * using the lvalue *cookiep of type
void *, which is not allowed. Given the APIs of nvlist_next(),
nvlist_get_parent() and nvlist_get_pararr(), one possible fix is to create a
local void *cookie in nvlist_xdescriptors() and other places, and to convert
the value to nvpair_t * when necessary. This patch implements that fix.

Details

Provenance
jillesAuthored on
Parents
rS325371: Add the LTO-8 Type M density code (0x5d, LTO-8M) to libmt and the
Branches
Unknown
Tags
Unknown