On Mon, Jul 09, 2012 at 10:40:13AM +0200, Johannes Berg wrote: > Dan, > > It seems like smatch doesn't have issues with this: > > static void *array[MAX]; > > ... > > for (i = 0; i < MAX; i++) > if (!array[i]) > break; > > if (i == MAX) > return -EINVAL; > array[i] = ...; > > but if we modify this to > > if (WARN_ON_ONCE(i == MAX)) > return -EINVAL; > > or WARN_ON() then it warns about an out-of-bounds array access. > > johannes The bug is caused because Smatch is supposed to ignore: WARN_ON(i == MAX); but pay attention to: if (WARN_ON(i == MAX)) { ... But the code to do that was buggy. I've fixed it now. I'll try take a look at the other bug as well. (If nothing else I'll just comment out the message). 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