diff options
author | Mariusz Zaborski <oshogbo@FreeBSD.org> | 2017-09-21 10:03:14 +0000 |
---|---|---|
committer | Mariusz Zaborski <oshogbo@FreeBSD.org> | 2017-09-21 10:03:14 +0000 |
commit | 1dacabe1aba037e9904d0de707bdd526d4294558 (patch) | |
tree | d98731db9cd4fb7e276a533f39d3f4437a0d0f65 /sys/contrib/libnv | |
parent | 08016b31854e031ee42dd841fe0e717927210397 (diff) | |
download | src-1dacabe1aba037e9904d0de707bdd526d4294558.tar.gz src-1dacabe1aba037e9904d0de707bdd526d4294558.zip |
The 'while (array != NULL) { }' suggests scan-build that array may be
initially NULL, which is not possible. Change the loop to
'do {} while (array != NULL)' to satisfy scan-build and assert that
array really cannot be NULL just in case.
Submitted by: pjd@
Found by: scan-build
MFC after: 1 month
Sponsored by: Wheel Systems
Notes
Notes:
svn path=/head/; revision=323852
Diffstat (limited to 'sys/contrib/libnv')
-rw-r--r-- | sys/contrib/libnv/nvlist.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/contrib/libnv/nvlist.c b/sys/contrib/libnv/nvlist.c index 8fcc24e40458..4aadbcbcf62e 100644 --- a/sys/contrib/libnv/nvlist.c +++ b/sys/contrib/libnv/nvlist.c @@ -1200,12 +1200,13 @@ nvlist_xunpack(const void *buf, size_t size, const int *fds, size_t nfds, &array); if (ptr == NULL) goto failed; + PJDLOG_ASSERT(array != NULL); tmpnvl = array; - while (array != NULL) { + do { nvlist_set_parent(array, nvp); array = __DECONST(nvlist_t *, nvlist_get_array_next(array)); - } + } while (array != NULL); ptr = nvlist_unpack_header(tmpnvl, ptr, nfds, &isbe, &left); break; |