From: Mike Snitzer <snitzer@kernel.org>
To: Tomas Melin <tomas.melin@vaisala.com>
Cc: dm-devel@redhat.com, agk@redhat.com
Subject: Re: [dm-devel] md: dm-table: ensure dev_t is initialized
Date: Wed, 1 Feb 2023 11:20:43 -0500 [thread overview]
Message-ID: <Y9qRW5AEXZL0jLnF@redhat.com> (raw)
In-Reply-To: <20230131111552.24349-1-tomas.melin@vaisala.com>
On Tue, Jan 31 2023 at 6:15P -0500,
Tomas Melin <tomas.melin@vaisala.com> wrote:
> Avoid returning uninitialized value in case
> lookup fails.
>
> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
> ---
> drivers/md/dm-table.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> index 8fc44c9f746a..71c59455bf3b 100644
> --- a/drivers/md/dm-table.c
> +++ b/drivers/md/dm-table.c
> @@ -331,7 +331,7 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,
> */
> dev_t dm_get_dev_t(const char *path)
> {
> - dev_t dev;
> + dev_t dev = 0;
>
> if (lookup_bdev(path, &dev))
> dev = name_to_dev_t(path);
dev_t dm_get_dev_t(const char *path)
{
dev_t dev;
if (lookup_bdev(path, &dev))
dev = name_to_dev_t(path);
return dev;
}
If lookup fails then:
dev = name_to_dev_t(path);
name_to_dev_t() will initialize dev no matter what.
Nacked-by: Mike Snitzer <snitzer@kernel.org>
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
prev parent reply other threads:[~2023-02-01 16:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-31 11:15 [dm-devel] [PATCH] md: dm-table: ensure dev_t is initialized Tomas Melin
2023-02-01 16:20 ` Mike Snitzer [this message]
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=Y9qRW5AEXZL0jLnF@redhat.com \
--to=snitzer@kernel.org \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=tomas.melin@vaisala.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.