helper_thread: check for null scalloc return value
authorVincent Fu <vincent.fu@samsung.com>
Tue, 11 Jun 2024 20:19:38 +0000 (16:19 -0400)
committerVincent Fu <vincent.fu@samsung.com>
Tue, 11 Jun 2024 20:19:38 +0000 (16:19 -0400)
commita15118757dad19c7f17700903d169676f244e318
tree6ae802ee7aa644f6af1188b2da11ac2bc1b1b3cf
parentc09359cd0bcd60d8931f2260908d54d46f2190d5
helper_thread: check for null scalloc return value

scalloc can return NULL if it fails to allocate memory. Check for this
condition and fail the helper thread setup if it occurs.

This issue was reported by Coverity:

** CID 496644:  Null pointer dereferences  (NULL_RETURNS)
/helper_thread.c: 425 in helper_thread_create()
419
420      hd = scalloc(1, sizeof(*hd));
421
422      setup_disk_util();
423      steadystate_setup();
424
>>>     CID 496644:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing "hd", which is known to be "NULL".
425      hd->sk_out = sk_out;

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
helper_thread.c