Powered by Linux
Re: %p extension checking — Semantic Matching Tool

Re: %p extension checking

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

 



On Wed, Feb 11 2015, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:

> Wow!  So exciting!  :)

Glad you like it :)

>> 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.
>

Well, I wanted to make it easy to do a range assuming one was
implementing a set of related tests (--enable=40-44), but it should be
rather easy to support both (just look at whether the first char of each
'range' is a letter or digit). Anyway, I purposely didn't add text to
--help.

>> 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.

I've been wanting to suggest adding -Wsuggest-attribute=format to the
kernel's build flags for some time, but haven't gotten around to it. It
also requires a somewhat recent gcc (4.8+, I think). My perl script also
only picks up those with that attribute. Maybe I should simply generate
a list of any function declaring a va_list on the stack and compare the
two lists...

> You'd have to do a add_hook(&match_call_info, FUNCTION_CALL_HOOK) and
> look at the function symbol.

OK. But since this works for now I'm not going to try to patch sparse to
recognize the attribute.

>> 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.

That's not really on purpose, but OTOH they were also mostly RFC. I
don't usually care about the legalese - most of the stuff I put online
(github or elsewhere) can be used by anyone for anything.

Rasmus
--
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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux