re: staging/mei: don't check if list is empty before looping

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

 



Hello Tomas Winkler,

This is a semi-automatic email about new static checker warnings.

The patch b7cd2d9fdc01: "staging/mei: don't check if list is empty 
before looping" from Nov 27, 2011, leads to the following Smatch 
complaint:

drivers/staging/mei/init.c +55 mei_io_list_flush()
	 warn: variable dereferenced before check 'pos' (see line 54)

drivers/staging/mei/init.c
    53	
    54		list_for_each_entry_safe(pos, next, &list->mei_cb.cb_list, cb_list) {
    55			if (pos) {
                        ^^^^^^^^^^
This check isn't needed.  The list cursor in a list_for_each() loop is
always a valid pointer (until we free it or whatever we do ourselves).

    56				struct mei_cl *cl_tmp;
    57				cl_tmp = (struct mei_cl *)pos->file_private;

There is a similar thing in mei_reset().

drivers/staging/mei/init.c +335 mei_reset(85)
	warn: variable dereferenced before check 'cb_pos' (see line 333)

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux