Linux-NVME Archive mirror
 help / color / mirror / Atom feed
From: Tokunori Ikegami <ikegami.t@gmail.com>
To: linux-nvme@lists.infradead.org
Cc: Tokunori Ikegami <ikegami.t@gmail.com>
Subject: [PATCH] nvme: initialize identify ns data to NULL
Date: Tue, 26 Mar 2024 00:45:03 +0900	[thread overview]
Message-ID: <20240325154503.11510-1-ikegami.t@gmail.com> (raw)

Currently nvme_identify_ns() sets the data to NULL if failed.
Also the data is not freed if the function returned failure.
But correctly the data should be initialized to NULL.
So to make sure fix to initialize the data to NULL.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
---
 drivers/nvme/host/sysfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index 3c55f7edd181..4e996e10f46a 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -185,7 +185,7 @@ static DEVICE_ATTR_RO(metadata_bytes);
 
 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;
 
@@ -212,7 +212,7 @@ static int ns_head_update_nuse(struct nvme_ns_head *head)
 
 static int ns_update_nuse(struct nvme_ns *ns)
 {
-	struct nvme_id_ns *id;
+	struct nvme_id_ns *id = NULL;
 	int ret;
 
 	/* Avoid issuing commands too often by rate limiting the update. */
-- 
2.40.1



             reply	other threads:[~2024-03-25 15:45 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 ` Tokunori Ikegami [this message]
2024-03-26  8:20   ` [PATCH] nvme: initialize identify ns data to NULL 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

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=20240325154503.11510-1-ikegami.t@gmail.com \
    --to=ikegami.t@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).