From: James Jones Date: Wed, 22 Jun 2022 21:11:40 +0000 (-0500) Subject: Annotate calls that as used will not return NULL (CID #1503961) (#4577) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffdcdc2d66b7c8669e91fe9f4f74209dd694424b;p=thirdparty%2Ffreeradius-server.git Annotate calls that as used will not return NULL (CID #1503961) (#4577) The calls in question are those in pair_list_init() that iterate over a pair list built up from a string. As long as the string is non-empty, the pair list won't be empty. As long as perc (the percentage) is no larger than 100, the code won't pass NULL to fr_pair_copy()... and one can see that's the case for all calls to pair_list_init(). Coverity apparently doesn't look at that context. --- diff --git a/src/lib/util/pair_list_perf_test.c b/src/lib/util/pair_list_perf_test.c index b5c34553846..65a500d79a3 100644 --- a/src/lib/util/pair_list_perf_test.c +++ b/src/lib/util/pair_list_perf_test.c @@ -215,10 +215,13 @@ static void pair_list_init(TALLOC_CTX *ctx, fr_pair_t ***out, fr_dict_t const *d * to use for duplicating attributes to required percentage. * Duplicates are at the beginning of the source list */ + /* coverity[null_returns] */ vp = fr_pair_list_head(&list); for (j = 0; j < (size_t)(input_count * perc / 100); j++) { + /* coverity[null_returns] */ new_vp = fr_pair_copy(ctx, vp); fr_pair_append(&dups, new_vp); + /* coverity[null_returns] */ vp = fr_pair_list_next(&list, vp); } }