]> sourceware.org Git - lvm2.git/commitdiff
cov: split check for type assignment
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 1 Nov 2018 14:33:34 +0000 (15:33 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Sat, 3 Nov 2018 15:09:36 +0000 (16:09 +0100)
Check that type is always defined, if not make it explicit internal
error (although logged as debug - so catched only with proper lvm.conf
setting).
This ensures later type being NULL can't be dereferenced with coredump.

libdm/libdm-report.c

index a4470170431f542bcdeffad7aa7f0ef2ae5f04a2..b0c89ab6134750b82170aa53aafb56f6bf1c5c3f 100644 (file)
@@ -748,10 +748,11 @@ static void _display_fields_more(struct dm_report *rh,
                        id_len = strlen(type->prefix) + 3;
 
        for (f = 0; fields[f].report_fn; f++) {
-               if ((type = _find_type(rh, fields[f].type)) && type->desc)
-                       desc = type->desc;
-               else
-                       desc = " ";
+               if (!(type = _find_type(rh, fields[f].type))) {
+                       log_debug(INTERNAL_ERROR "Field type undefined.");
+                       continue;
+               }
+               desc = (type->desc) ? : " ";
                if (desc != last_desc) {
                        if (*last_desc)
                                log_warn(" ");
This page took 0.040004 seconds and 5 git commands to generate.