[bug report] lib: add light-weight queuing mechanism.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello NeilBrown,

The patch 16c486356b1a: "lib: add light-weight queuing mechanism."
from Sep 11, 2023 (linux-next), leads to the following Smatch static
checker warning:

	lib/lwq.c:114 lwq_test()
	error: potential null dereference 't'.  (kmalloc returns null)

lib/lwq.c
    104         struct tnode *t;
    105         struct task_struct *threads[8];
    106 
    107         printk(KERN_INFO "testing lwq....\n");
    108         lwq_init(&q);
    109         printk(KERN_INFO " lwq: run some threads\n");
    110         for (i = 0; i < ARRAY_SIZE(threads); i++)
    111                 threads[i] = kthread_run(lwq_exercise, &q, "lwq-test-%d", i);
    112         for (i = 0; i < 100; i++) {
    113                 t = kmalloc(sizeof(*t), GFP_KERNEL);
--> 114                 t->i = i;
                        ^^^^
The kmalloc() isn't checked.

    115                 t->c = 0;
    116                 if (lwq_enqueue(&t->n, &q))
    117                         wake_up_var(&q);
 
regards,
dan carpenter



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux