From: Bart Van Assche Date: Sat, 11 Jan 2020 23:45:32 +0000 (-0800) Subject: t/memlock: Verify 'threads' argument X-Git-Tag: fio-3.18~12^2~2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=63ef965dc21350ad093f3072b201ae965800c41b;p=fio.git t/memlock: Verify 'threads' argument This patch fixes the following Coverity complaint: CID 280681 (#1 of 1): Untrusted value as argument (TAINTED_SCALAR) 4. tainted_data: Passing tainted variable threads to a tainted sink. Signed-off-by: Bart Van Assche --- diff --git a/t/memlock.c b/t/memlock.c index ebedb91d..418dc3c4 100644 --- a/t/memlock.c +++ b/t/memlock.c @@ -43,6 +43,10 @@ int main(int argc, char *argv[]) mib = strtoul(argv[1], NULL, 10); threads = strtoul(argv[2], NULL, 10); + if (threads < 1 || threads > 65536) { + printf("%s: invalid 'threads' argument\n", argv[0]); + return 1; + } pthreads = calloc(threads, sizeof(pthread_t)); td.mib = mib;