[lvm-devel] [PATCH 03/30] Check (type) is not NULL before access
Zdenek Kabelac
zkabelac at redhat.com
Mon Oct 25 08:24:10 UTC 2010
clang Logic error Dereference of null pointer
Signed-off-by: Zdenek Kabelac <zkabelac at redhat.com>
---
libdm/libdm-report.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 7631e21..28b27b2 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -273,9 +273,10 @@ static void _display_fields(struct dm_report *rh)
log_warn("%*.*s", (int) strlen(desc) + 7,
(int) strlen(desc) + 7,
"-------------------------------------------------------------------------------");
- log_warn(" %sall%-*s - %s", type->prefix,
- (int) (id_len - 3 - strlen(type->prefix)), "",
- "All fields in this section.");
+ if (type)
+ log_warn(" %sall%-*s - %s", type->prefix,
+ (int) (id_len - 3 - strlen(type->prefix)), "",
+ "All fields in this section.");
}
/* FIXME Add line-wrapping at terminal width (or 80 cols) */
--
1.7.3.1
More information about the lvm-devel
mailing list