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>
struct flist_head *list;
l = scalloc(1, sizeof(*l));
+ assert(l);
INIT_FLIST_HEAD(&l->io_logs);
l->log_type = p->log_type;
l->log_offset = p->log_offset;