Commit 02197fa749e21107e3330b2a244f7d5c455e456e
Committed by
Simon Glass
1 parent
dfd5321bec
Exists in
smarc_8mq_lf_v2020.04
and in
9 other branches
dm: dump.c: Fix segfault when entry->of_match is NULL
Currently, dm drivers command produces a segfault: => dm drivers Driver Compatible -------------------------------- Segmentation fault (core dumped) This is caused by a NULL pointer dereference of entry->of_match. Add a check to prevent this. Signed-off-by: Ovidiu Panait <ovpanait@gmail.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org>
Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff
drivers/core/dump.c
... | ... | @@ -107,7 +107,8 @@ |
107 | 107 | puts("Driver Compatible\n"); |
108 | 108 | puts("--------------------------------\n"); |
109 | 109 | for (entry = d; entry < d + n_ents; entry++) { |
110 | - for (match = entry->of_match; match->compatible; match++) | |
110 | + for (match = entry->of_match; | |
111 | + match && match->compatible; match++) | |
111 | 112 | printf("%-20.20s %s\n", |
112 | 113 | match == entry->of_match ? entry->name : "", |
113 | 114 | match->compatible); |