Wow! So exciting! :) On Wed, Feb 11, 2015 at 11:34:43AM +0100, Rasmus Villemoes wrote: > Hi, > > As mentioned, I've been working on getting smatch to do type checking of > the various %p format extensions. The code is now on github > (https://github.com/Villemoes/smatch). > > Note that this work revealed a bug in sparse's handling of string > literals coming from macro expansions > (http://thread.gmane.org/gmane.comp.parsers.sparse/4080). I've applied > one of the suggested fixes, but it's still not clear to me what the > final fix will be in sparse upstream. Anyway, this was good enough to > get the ball rolling. > > While developing this, I found it useful to only enable that specific > check (both to get smatch run faster and to get less noise in the > output), so there's also a few unrelated patches in the printf branch > implementing that feature. It probably would have been better to say --enable="check_free" or whatever. Still, I'll merge this as-is and change it later if anyone gets around to it. I should measure this to see which tests are slow. > > sparse currently ignores attribute((format)), so the list of printf functions > has been extracted with a perl script and hard-coded. Even if sparse > understood attribute((format)), I wouldn't know how to set up a hook for > 'call of function with this or that attribute'. Also probably people don't use that attribute all the time. You'd have to do a add_hook(&match_call_info, FUNCTION_CALL_HOOK) and look at the function symbol. > > I don't think it's ready to be merged upstream (and whether that will > even happen is of course entirely up to Dan), but now it's out there for > people to play with. I have already sent patches for the four %p bugs > found, but there may be a few more lurking in arch/<not x86>/ - I don't > know how to pursuade the build system to go there. None of these patches have a Signed-off-by line. I'll test them tonight. Thanks! 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