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@xxxxxxxxxxx> --- 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