From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: master - cov: split check for type assignment
Date: Tue, 20 Oct 2020 20:34:13 +0000 (GMT) [thread overview]
Message-ID: <20201020203413.ACA08395182E@sourceware.org> (raw)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3e06061d82dbcc2f464f0fdcd6610f25177bfa1f
Commit: 3e06061d82dbcc2f464f0fdcd6610f25177bfa1f
Parent: a17ec7e0baa737b45900cc4f97823c95f9dd8c56
Author: Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate: Mon Oct 19 16:43:50 2020 +0200
Committer: Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Oct 19 16:53:19 2020 +0200
cov: split check for type assignment
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.
---
device_mapper/libdm-report.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/device_mapper/libdm-report.c b/device_mapper/libdm-report.c
index 85d3d0f82..9279e3370 100644
--- a/device_mapper/libdm-report.c
+++ b/device_mapper/libdm-report.c
@@ -749,10 +749,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(" ");
next reply other threads:[~2020-10-20 20:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-20 20:34 Zdenek Kabelac [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-11-05 16:27 master - cov: split check for type assignment Zdenek Kabelac
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201020203413.ACA08395182E@sourceware.org \
--to=zkabelac@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.