[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <61ead92e-c65e-4872-843b-4a71b395d486@web.de>
Date: Mon, 3 Nov 2025 07:33:42 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: cocci@...ia.fr, kernel-janitors@...r.kernel.org
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] Detecting missing null pointer checks after memory
allocations
> I got into the mood to try another simple source code search out which
> can be achieved also by the means of the semantic patch language.
I would like to present further data processing approaches accordingly.
The application of a tiny function name selection was demonstrated
by an SmPL disjunction (which can be extended on demand).
Additional techniques can become more helpful for advanced code reviews.
* Further preparations would be needed in software infrastructures (ACID properties)
if you would like to benefit more from parallel data processing here.
* It might be easier for a while to stick to a serial data processing approach
like the following.
@initialize:python@
@@
import sys
records = []
def store_data(id, places):
"""Add data to an internal list."""
for place in places:
records.append((id, place.current_element, place.file, place.line, str(int(place.column) + 1)))
@searching@
expression size, source, target;
identifier action;
position pos;
@@
target = action@pos(...);
memcpy(target, source, size);
@script:python collection@
id << searching.action;
place << searching.pos;
@@
store_data(id, place)
@finalize:python@
@@
if records:
delimiter = "|"
sys.stdout.write(delimiter.join(["action", '"function name"', '"source file"', "line", "column"]) + "\n")
for record in records:
sys.stdout.write(delimiter.join(record) + "\n")
else:
sys.stderr.write("No result for this analysis!\n")
A text file can accordingly be generated by the Coccinelle software. It can be
imported into a spreadsheet application. A Pivot table can be constructed then.
Would you become interested to take another look at the 71 called actions
(from 121 source files of the software “Linux next-20251031”) if they would need
the check for a failure predicate before copying data to affected memory areas?
https://cwe.mitre.org/data/definitions/252.html
Under which circumstances will error detection and corresponding exception
handling be completed?
https://wiki.sei.cmu.edu/confluence/display/c/EXP34-C.+Do+not+dereference+null+pointers#EXP34C.Donotdereferencenullpointers-AutomatedDetection
Regards,
Markus
Powered by blists - more mailing lists