On Tue, Jan 28, 2014 at 05:32:58PM -0500, Joe Lawrence wrote: > On Tue, 28 Jan 2014 03:32:47 +0300 > Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote: > > > The infinite loop check seems to work pretty well. > > This is pretty neat. A question about the warnings out of the ixgb > driver. For example: > > drivers/net/ethernet/intel/ixgb/ixgb_hw.c:777 ixgb_read_phy_reg() warn: this loop depends on readl() succeeding > > 767 for (i = 0; i < 10; i++) > 768 { > 769 udelay(10); > 770 > 771 command = IXGB_READ_REG(hw, MSCA); > 772 > 773 if ((command & IXGB_MSCA_MDI_COMMAND) == 0) > 774 break; > 775 } > 776 > 777 ASSERT((command & IXGB_MSCA_MDI_COMMAND) == 0); > > is smatch warning about the for loops or the ASSERT macro? > > These particular for(0..9) loops can't loop infinitely. Maybe the > ASSERT is implemented as a "do {} while(0)" that is triggering the > warning? Yes. It's warning about the ASSERT. It's implemented like this: #define ASSERT(x) BUG_ON(!(x)) #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) We never exit the do {} while (0) loop because we hit BUG(). regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe smatch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html