diff options
author | Vincent Fu <vincent.fu@samsung.com> | 2024-04-04 16:40:03 +0000 |
---|---|---|
committer | Vincent Fu <vincent.fu@samsung.com> | 2024-04-24 13:44:09 -0400 |
commit | 3dabef7c3139835d4afada65fb3f7ac8609e42eb (patch) | |
tree | 03a9820be8fd6530529bc81c4e65065acab534a3 | |
parent | 1a3a21b73727358c8bb9b4a9762ce30acd9e492e (diff) | |
download | fio-3dabef7c3139835d4afada65fb3f7ac8609e42eb.tar.gz |
options: reject placement IDs larger than the max
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>
-rw-r--r-- | options.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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); |