Skip to contentSkip to conversation

rasdaemon: fix mcgstatus_msg length check

PATCH Aristeu Rozanski 1 participant 1 message Aug 9, 2018 EDAC-core

lore
Share & tools
lore
#0 lore raw

Found with covscan:

	ras-mce-handler.c:337: array_null: Comparing an array to null is not useful: "e->mcgstatus_msg", since the test will always evaluate as true.

---
To unsubscribe from this list: send the line "unsubscribe linux-edac" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

ras-mce-handler.c +1 -1
index 4030b8c..014ca43 100644
@@ -331,7 +331,7 @@ static void report_mce_event(struct ras_events *ras,
 	if (e->status & MCI_STATUS_ADDRV)
 		trace_seq_printf(s, ", addr= %llx", (long long)e->addr);
 
-	if (e->mcgstatus_msg)
+	if (strnlen(e->mcgstatus_msg, sizeof(e->mcgstatus_msg)))
 		trace_seq_printf(s, ", %s", e->mcgstatus_msg);
 	else
 		trace_seq_printf(s, ", mcgstatus= %llx",