On Fri, Aug 03, 2018 at 05:09:45PM +0200, Greg Kroah-Hartman wrote:
On Fri, Aug 03, 2018 at 04:59:18PM +0200, Andrey Konovalov wrote:
Started looking at this. When I run sparse with default checks enabled (make C=1) I get countless warnings. Does anybody actually use it?
Try using a more up-to-date version of sparse. Odds are you are using an old one, there is a newer version in a different branch on kernel.org somewhere...
That's not true. Building the current version of sparse from git://git.kernel.org/pub/scm/devel/sparse/sparse.git leaves me with a thousand errors just building the mm/ directory. A sample:
../mm/filemap.c:2353:21: warning: expression using sizeof(void) ../mm/filemap.c:2618:35: warning: symbol 'generic_file_vm_ops' was not declared. Should it be static? ../include/linux/slab.h:666:13: error: undefined identifier '__builtin_mul_overflow' ../include/linux/slab.h:666:13: warning: call with no type! ../include/linux/rcupdate.h:683:9: warning: context imbalance in 'find_lock_task_mm' - wrong count at exit ../include/linux/sched/mm.h:141:37: warning: dereference of noderef expression ../mm/page_alloc.c:886:1: error: directive in argument list ../include/trace/events/vmscan.h:79:1: warning: cast from restricted gfp_t ../include/trace/events/vmscan.h:196:1: warning: too many warnings (ahem!) ../mm/mmap.c:137:9: warning: cast to non-scalar ../mm/mmap.c:137:9: warning: cast from non-scalar ../mm/page_vma_mapped.c:134:29: warning: Using plain integer as NULL pointer ../include/linux/slab.h:631:13: warning: call with no type!
Basically, nobody is fixing their shit. The only way that sparse output is useful is to log the warnings before your changes, log them afterwards and run diff. The worst offender (as in: fixing it would remove most of the warnings) is the new min()/max() macro:
ra->start = max_t(long, 0, offset - ra->ra_pages / 2);
produces that first warning at line 2353 of filemap.c. I have no idea if this is a sparse mistake or something it's genuinely warning us about, but the sparse warnings are pretty ineffectual because nobody's paying attention to them. -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html