From: Tokunori Ikegami <ikegami.t@gmail.com>
To: Keith Busch <kbusch@kernel.org>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvme: initialize identify ns data to NULL
Date: Wed, 27 Mar 2024 00:54:20 +0900 [thread overview]
Message-ID: <cf8d2f4e-8259-4625-ab05-84e2669a5238@gmail.com> (raw)
In-Reply-To: <ZgLro-TUD821wu16@kbusch-mbp.dhcp.thefacebook.com>
Okay I see. The nvme_identify_ns_nvm() version only sets the memory
allocated to the output parameter nvmp before the return success so if
the nvme_identify_ns() also changed as same the NULL initialization
works correctly. Thank you.
On 2024/03/27 0:37, Keith Busch wrote:
> On Tue, Mar 26, 2024 at 12:45:03AM +0900, Tokunori Ikegami wrote:
>> static int ns_head_update_nuse(struct nvme_ns_head *head)
>> {
>> - struct nvme_id_ns *id;
>> + struct nvme_id_ns *id = NULL;
>> struct nvme_ns *ns;
>> int srcu_idx, ret = -EWOULDBLOCK;
> This is a redundant setting. The first thing that happens to "id" is
> reference passed to nvme_identify_ns, and the first thing it does is
> this:
>
> *id = kmalloc(sizeof(**id), GFP_KERNEL);
>
> So either kmalloc succeeds and overwrites your NULL setting, or malloc
> fails and sets it to NULL again.
prev parent reply other threads:[~2024-03-26 15:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240325154544epcas5p4acf7f376241637872a433314489586fa@epcas5p4.samsung.com>
2024-03-25 15:45 ` [PATCH] nvme: initialize identify ns data to NULL Tokunori Ikegami
2024-03-26 8:20 ` Sagi Grimberg
2024-03-26 13:35 ` Tokunori Ikegami
2024-03-26 8:50 ` Kanchan Joshi
2024-03-26 13:51 ` Tokunori Ikegami
[not found] ` <a92a1493-29ae-4f89-b17b-54d03ec0becc@gmail.com>
2024-03-26 14:02 ` Kanchan Joshi
2024-03-26 14:56 ` Tokunori Ikegami
2024-03-26 15:37 ` Keith Busch
2024-03-26 15:54 ` Tokunori Ikegami [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=cf8d2f4e-8259-4625-ab05-84e2669a5238@gmail.com \
--to=ikegami.t@gmail.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
/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.