t/memlock: Verify 'threads' argument
[fio.git] / t / memlock.c
index ebedb91d4eb67417563fd4e969e52d6b9bf3feec..418dc3c48fd0c1b4cf8596564ee22f3f661fd92a 100644 (file)
@@ -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;