From: Jens Axboe Date: Wed, 26 Sep 2018 02:15:05 +0000 (-0600) Subject: parse: fix negative FIO_OPT_INT too-large check X-Git-Tag: fio-3.11~20 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=7676a1c25fcdacfe27d84a0f86fe68077b7de79a parse: fix negative FIO_OPT_INT too-large check If we have an option, like nice, that has a minval that is negative, then we need to ensure we cast properly for the check. Signed-off-by: Jens Axboe --- diff --git a/parse.c b/parse.c index 84d112dc..a7d4516e 100644 --- a/parse.c +++ b/parse.c @@ -512,8 +512,11 @@ static bool val_too_large(const struct fio_option *o, unsigned long long val, if (!o->maxval) return false; - if (is_uint) + if (is_uint) { + if ((int) val < 0) + return (int) val > (int) o->maxval; return (unsigned int) val > o->maxval; + } return val > o->maxval; }