[PATCH] mm/writeback: fix dereferencing NULL mapping->host
Andrew Yang
andrew.yang at mediatek.com
Mon Nov 28 19:32:59 PST 2022
From: "andrew.yang" <andrew.yang at mediatek.com>
Check before dereferencing mapping->host
Signed-off-by: andrew.yang <andrew.yang at mediatek.com>
---
include/trace/events/writeback.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 86b2a82da546..56f6e114d3ed 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -68,7 +68,7 @@ DECLARE_EVENT_CLASS(writeback_folio_template,
strscpy_pad(__entry->name,
bdi_dev_name(mapping ? inode_to_bdi(mapping->host) :
NULL), 32);
- __entry->ino = mapping ? mapping->host->i_ino : 0;
+ __entry->ino = mapping && mapping->host ? mapping->host->i_ino : 0;
__entry->index = folio->index;
),
--
2.18.0
More information about the Linux-mediatek
mailing list