fio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Fu <vincentfu@gmail.com>
To: axboe@kernel.dk, ankit.kumar@samsung.com, kbusch@kernel.org,
	fio@vger.kernel.org
Cc: Vincent Fu <vincent.fu@samsung.com>
Subject: [PATCH 5/9] options: reject placement IDs larger than the max
Date: Mon, 22 Apr 2024 13:49:51 -0400	[thread overview]
Message-ID: <20240422175522.4614-6-vincent.fu@samsung.com> (raw)
In-Reply-To: <20240422175522.4614-1-vincent.fu@samsung.com>

Placement IDs are a 16-bit value. So we should notify users if the
provided placement IDs are too large.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
---
 options.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/options.c b/options.c
index 09a24652..ece90c72 100644
--- a/options.c
+++ b/options.c
@@ -270,8 +270,15 @@ static int str_fdp_pli_cb(void *data, const char *input)
 	strip_blank_front(&str);
 	strip_blank_end(str);
 
-	while ((v = strsep(&str, ",")) != NULL && i < FIO_MAX_DP_IDS)
-		td->o.dp_ids[i++] = strtoll(v, NULL, 0);
+	while ((v = strsep(&str, ",")) != NULL && i < FIO_MAX_DP_IDS) {
+		unsigned long long id = strtoll(v, NULL, 0);
+		if (id > 0xFFFF) {
+			log_err("Placement IDs cannot exceed 0xFFFF\n");
+			free(p);
+			return 1;
+		}
+		td->o.dp_ids[i++] = id;
+	}
 	free(p);
 
 	qsort(td->o.dp_ids, i, sizeof(*td->o.dp_ids), fio_fdp_cmp);
-- 
2.43.0


  parent reply	other threads:[~2024-04-22 17:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22 17:49 [PATCH 0/9] FDP tweaks, NVMe streams support Vincent Fu
2024-04-22 17:49 ` [PATCH 1/9] fio: rename fdp.[c,h] to dataplacement.[c,h] Vincent Fu
2024-04-22 17:49 ` [PATCH 2/9] fio: create over-arching data placement option Vincent Fu
2024-04-23  8:36   ` Ankit Kumar
2024-04-23 15:27     ` Vincent Fu
2024-04-22 17:49 ` [PATCH 3/9] t/nvmept_fdp.py: test script for FDP Vincent Fu
2024-04-22 17:49 ` [PATCH 4/9] fio: support NVMe streams Vincent Fu
2024-04-22 17:49 ` Vincent Fu [this message]
2024-04-22 17:49 ` [PATCH 6/9] options: parse placement IDs as unsigned values Vincent Fu
2024-04-22 17:49 ` [PATCH 7/9] dataplacement: add a debug print for IOs Vincent Fu
2024-04-22 17:49 ` [PATCH 8/9] t/nvmept_streams: test NVMe streams support Vincent Fu
2024-04-22 17:49 ` [PATCH 9/9] docs: update for new data placement options Vincent Fu
2024-04-23  8:49 ` [PATCH 0/9] FDP tweaks, NVMe streams support Ankit Kumar
2024-04-23 15:16   ` Vincent Fu
2024-04-24 18:48     ` Vincent Fu

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=20240422175522.4614-6-vincent.fu@samsung.com \
    --to=vincentfu@gmail.com \
    --cc=ankit.kumar@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=kbusch@kernel.org \
    --cc=vincent.fu@samsung.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 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).