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

From: Markus Elfring

Date: Sun Dec 06 2026 - 07:52:58 EST


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

Regards,
Markus