Skip to contentSkip to conversation

nvme: plugins/fdp, check endurance group identifier

PATCH New Nitesh Shetty 1 participant 1 message Nov 29, 2024 1 message not in the archive NVMe

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20241129061514epcas5p48af9d40e58ddf2acf92652031cb09eb0@epcas5p4.samsung.com

#1 lore raw

PATCH 1/1 nvme: plugins/fdp, check endurance group identifier

For FDP options such as stats and events, default endurance identifier 0 is used which results in error.
This patch returns error for missing endurance group identifier from user.

---
 plugins/fdp/fdp.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
plugins/fdp/fdp.c +12 -0
index cac0b2bd..c61706ac 100644
@@ -215,6 +215,12 @@ static int fdp_stats(int argc, char **argv, struct command *cmd, struct plugin *
 	if (cfg.raw_binary)
 		flags = BINARY;
 
+	if (!cfg.egid) {
+		fprintf(stderr, "endurance group identifier required\n");
+		err = -EINVAL;
+		goto out;
+	}
+
 	memset(&stats, 0x0, sizeof(stats));
 
 	err = nvme_get_log_fdp_stats(dev->direct.fd, cfg.egid, 0, sizeof(stats), &stats);
@@ -276,6 +282,12 @@ static int fdp_events(int argc, char **argv, struct command *cmd, struct plugin
 	if (cfg.raw_binary)
 		flags = BINARY;
 
+	if (!cfg.egid) {
+		fprintf(stderr, "endurance group identifier required\n");
+		err = -EINVAL;
+		goto out;
+	}
+
 	memset(&events, 0x0, sizeof(events));
 
 	err = nvme_get_log_fdp_events(dev->direct.fd, cfg.egid,
Signature · 1 line
2.34.1