[PATCH linux dev-4.10] drivers: occ: Fix bad list access

Eddie James eajames at linux.vnet.ibm.com
Wed Aug 23 08:00:30 AEST 2017


From: "Edward A. James" <eajames at us.ibm.com>

list_first_entry() doesn't return NULL if the list is empty...

Signed-off-by: Edward A. James <eajames at us.ibm.com>
---
 drivers/fsi/occ.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fsi/occ.c b/drivers/fsi/occ.c
index d984e51..621fbf0 100644
--- a/drivers/fsi/occ.c
+++ b/drivers/fsi/occ.c
@@ -572,7 +572,7 @@ static void occ_worker(struct work_struct *work)
 again:
 	spin_lock_irq(&occ->list_lock);
 
-	xfr = list_first_entry(&occ->xfrs, struct occ_xfr, link);
+	xfr = list_first_entry_or_null(&occ->xfrs, struct occ_xfr, link);
 	if (!xfr) {
 		spin_unlock_irq(&occ->list_lock);
 		return;
-- 
1.8.3.1



More information about the openbmc mailing list