procps_slabnode_stacks_sort() would check if stacks was NULL
*after* the pointer was derefenced in the initialisation of
the variable p.
p is now assigned after the check.
References:
Coverity #99160
enum slabnode_item sort)
{
#define QSORT_r int (*)(const void *, const void *, void *)
- struct slab_result *p = stacks[0]->head;
+ struct slab_result *p;
int offset = 0;;
if (info == NULL || stacks == NULL)
return NULL;
+
if (sort < 0 || sort > PROCPS_SLABNODE_noop)
return NULL;
if (numstacked > info->stacked->depth)
if (numstacked > info->stacked->inuse)
numstacked = info->stacked->inuse;
+ p = stacks[0]->head;
for (;;) {
if (p->item == sort)
break;