fix: check for a NULL list in for_each_list_entry()

Signed-off-by: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>