Re: [RFC] Detecting unchecked return values (with SmPL)?

From: Julia Lawall

Date: Sun Dec 06 2026 - 09:37:42 EST




> On 6 Dec 2026, at 13:52, Markus Elfring <Markus.Elfring@xxxxxx> wrote:
>
> 
>>
>> CWE-252: Unchecked Return Value
>
> How will development interests evolve further if it could be determined also
> with the help of another script variant (like the following) for the semantic
> patch language that the software “Linux next-20261204” contains at least
> 75 function calls (in 35 source files) where the return value was not immediately
> stored in a variable according to a single selected identifier?
>
> @display5@
> expression var;
> statement is, es;
> @@
> (if (request_resource(...)) is else es
> |if (request_resource(...) < 0) is else es
> |var = request_resource(...)
> |
> *if (request_resource(...) == 0) is
> |
> *request_resource(...)
> )
>
>
> Can any coccicheck script variations become more helpful for similar use cases?
>

I don’t see why you need both of the last two cases. Why isn’t the last one enough?

> Regards,
> Markus
>