Matt | 11 Nov 07:24

inline declaration and assignment

Hi,

I'm playing with smatch and noticed that an inline assignment doesn't seem 
to get parsed as such. There's a couple of examples, but this one in 
sparse's own parse.c (line 1480) is probably the best:
   struct ident *ident = NULL;

sparse doesn't seem to identify this as an assignment, only a declaration. 
as a result, smatch gives this false positive:
parse.c +1487 undefined param add_expression 1

Sorry if I'm incorrectly diagnosing the problem; I'm just diving into the 
code for the first time this evening :)

Thanks in advance for any help!

--
tangled strands of DNA explain the way that I behave.
http://www.clock.org/~matt
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Dan Carpenter | 15 Nov 13:20

Re: inline declaration and assignment

The thing is that smatch is pretty much abandon-ware until Christmas
because I'm cycling through Africa and don't have a computer to work
with...  :/

On Tue, Nov 11, 2008 at 9:24 AM, Matt <matt <at> use.net> wrote:
> Hi,
>
> I'm playing with smatch and noticed that an inline assignment doesn't seem
> to get parsed as such. There's a couple of examples, but this one in
> sparse's own parse.c (line 1480) is probably the best:
>  struct ident *ident = NULL;
>
>
> sparse doesn't seem to identify this as an assignment, only a declaration.
> as a result, smatch gives this false positive:
> parse.c +1487 undefined param add_expression 1
>

I really wanted to polish smatch up and make it presentable before I left
but I ran out of time.

The message isn't an error message.  It's means that "ident" could either
be null or non-null depending on the if statement.

If add_expression() dereferenced the parameter without checking then
a message gets printed out there too.

There was supposed to be a script that made a list of all the functions
that were called with undefined parameters and a list of all the functions
that don't check.  If a parameter shows up on both lists then it's
(Continue reading)


Gmane