iolog: check scalloc return value
authorVincent Fu <vincent.fu@samsung.com>
Tue, 11 Jun 2024 20:09:00 +0000 (16:09 -0400)
committerVincent Fu <vincent.fu@samsung.com>
Tue, 11 Jun 2024 20:09:00 +0000 (16:09 -0400)
commitb6eb53b7495e0427307cc599d495ab113bbd08f9
treeed1e32a98fb942d454f4217994236a090c191cb2
parentc6783fc35ab01eb7f8b92bd4369c7d277538fd88
iolog: check scalloc return value

It is possible for scalloc to return NULL. setup_log() does not return a
value to indicate failure but we can use an assert here to check for a
NULL scalloc return value. This will trigger an exception similar to the
segfault that would happen if scalloc returns null, but this should
silence Coverity.

This was reported by Coverity:

** CID 496646:  Null pointer dereferences  (NULL_RETURNS)
/iolog.c: 843 in setup_log()

*** CID 496646:  Null pointer dereferences  (NULL_RETURNS)
/iolog.c: 843 in setup_log()
837      struct io_log *l;
838      int i;
839      struct io_u_plat_entry *entry;
840      struct flist_head *list;
841
842      l = scalloc(1, sizeof(*l));
>>>     CID 496646:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing "l", which is known to be "NULL".

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