Coverity flags CPU_SET_S() calls as potential out-of-bounds writes
because it cannot trace that cpu_set_realloc() guarantees the
allocated buffer is large enough for the given index. Add asserts
to make the size invariant explicit.
CID#
1611787
CID#
1611788
Follow-up for
0985c7c4e22c8dbbea4398cf3453da45ebf63800
if (r < 0)
return r;
+ /* Silence static analyzers */
+ assert(i / CHAR_BIT < c->allocated);
CPU_SET_S(i, c->allocated, c->set);
return 0;
}
if (r < 0)
return r;
+ /* Silence static analyzers */
+ assert(end / CHAR_BIT < c->allocated);
for (size_t i = start; i <= end; i++)
CPU_SET_S(i, c->allocated, c->set);