From: Benjamin Marzinski <bmarzins@redhat.com>
To: Martin Wilck <martin.wilck@suse.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>,
Xose Vazquez Perez <xose.vazquez@gmail.com>,
dm-devel@lists.linux.dev
Subject: Re: [PATCH 1/2] libmultipath: fix missing return value check in snprint_devices()
Date: Mon, 8 Sep 2025 14:34:10 -0400 [thread overview]
Message-ID: <aL8hol-agJsYXaYk@redhat.com> (raw)
In-Reply-To: <20250905210714.167202-2-mwilck@suse.com>
On Fri, Sep 05, 2025 at 11:07:13PM +0200, Martin Wilck wrote:
> Coverity scan defect #488155.
>
Your fix looks fine, but the code I see right above it isn't. We should
not be returning a positive number here if things went wrong. Looking
at the udev_enumerate_new() code, we should be safe always trusting it to
set errno correctly. So, the code should probably be
if (!enm)
return -errno;
If you don't want to handle that is this commit then:
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> Fixes: d041258 ("libmultipath: snprint_devices(): use udev_enumerate")
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
> libmultipath/print.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libmultipath/print.c b/libmultipath/print.c
> index 019ae56..a7306f0 100644
> --- a/libmultipath/print.c
> +++ b/libmultipath/print.c
> @@ -1993,7 +1993,8 @@ int snprint_devices(struct config *conf, struct strbuf *buff,
> enm = udev_enumerate_new(udev);
> if (!enm)
> return 1;
> - udev_enumerate_add_match_subsystem(enm, "block");
> + if ((r = udev_enumerate_add_match_subsystem(enm, "block")) < 0)
> + goto out;
>
> if ((r = append_strbuf_str(buff, "available block devices:\n")) < 0)
> goto out;
> --
> 2.51.0
next prev parent reply other threads:[~2025-09-08 18:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 21:07 [PATCH 0/2] multipath-tools 0.12.0 - late minor fixes Martin Wilck
2025-09-05 21:07 ` [PATCH 1/2] libmultipath: fix missing return value check in snprint_devices() Martin Wilck
2025-09-08 18:34 ` Benjamin Marzinski [this message]
2025-09-09 8:57 ` Martin Wilck
2025-09-05 21:07 ` [PATCH 2/2] libmultipath/foreign/nvme: fix return value check in get_ctrl_blkdev() Martin Wilck
2025-09-08 18:54 ` Benjamin Marzinski
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=aL8hol-agJsYXaYk@redhat.com \
--to=bmarzins@redhat.com \
--cc=christophe.varoqui@opensvc.com \
--cc=dm-devel@lists.linux.dev \
--cc=martin.wilck@suse.com \
--cc=xose.vazquez@gmail.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.