From: Markus Elfring <Markus.Elfring@web.de>
To: cocci@inria.fr, kernel-janitors@vger.kernel.org
Subject: [cocci] Reconsidering kfree() calls for null pointers (with SmPL)
Date: Tue, 28 Mar 2023 17:55:12 +0200 [thread overview]
Message-ID: <6cbcf640-55e5-2f11-4a09-716fe681c0d2@web.de> (raw)
Hello,
I tried the following SmPL script out also on the source files from
the software “Linux next-20230324”.
@display@
expression call, storage;
identifier target;
@@
*storage = call(...);
*if (!storage)
goto target;
...
*target:
*kfree(storage)
119 source files were found where a check was performed for a failed function call
and a kfree() call is immediately performed for the same variable.
Thus a null pointer is probably passed at these source code places.
I imagine that such code should be reconsidered once more and improved accordingly.
How do you think about to achieve any adjustments in this design direction?
Regards,
Markus
next reply other threads:[~2023-03-28 15:55 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-28 15:55 Markus Elfring [this message]
2023-03-28 16:05 ` [cocci] Reconsidering kfree() calls for null pointers (with SmPL) Vlastimil Babka
2023-03-29 6:18 ` Markus Elfring
2023-03-29 7:25 ` Vlastimil Babka
2023-03-28 17:13 ` [cocci] [PATCH 0/2] ARM: Adjustments for init_atags_procfs() Markus Elfring
2023-03-28 17:15 ` [cocci] [PATCH 1/2] ARM: Delete an error message for a failed memory allocation in init_atags_procfs() Markus Elfring
2023-03-28 17:17 ` [cocci] [PATCH 2/2] ARM: Return directly after a failed kmalloc() " Markus Elfring
2024-01-10 11:48 ` [cocci] [PATCH 0/2] ARM: Adjustments for init_atags_procfs() Markus Elfring
2024-01-10 11:52 ` [cocci] [0/2] " Markus Elfring
[not found] ` <ZZ6MZl14bcIaCaQn@shell.armlinux.org.uk>
2024-01-10 12:44 ` Markus Elfring
[not found] ` <ZZ6R6KSQo9ph3ARZ@shell.armlinux.org.uk>
2024-01-10 12:52 ` Markus Elfring
[not found] ` <ZZ6gq5sOFf33GhM7@shell.armlinux.org.uk>
2024-01-10 14:00 ` Markus Elfring
[not found] ` <vltzbtbcuzrfgjoeg5oovdyoe34fnhte25uhb3gln56pzvmqzb@5u7u7cwgzzen>
2024-01-10 13:46 ` Markus Elfring
2023-03-28 18:45 ` [cocci] [PATCH 0/2] perf/x86/intel/pt: Adjustments for pt_pmu_hw_init() Markus Elfring
2023-03-28 18:50 ` [cocci] [PATCH 1/2] perf/x86/intel/pt: Use -ENOMEM directly for a return statement in pt_pmu_hw_init() Markus Elfring
2023-03-28 18:52 ` [cocci] [PATCH 2/2] perf/x86/intel/pt: Return directly after a failed kzalloc() " Markus Elfring
2024-01-10 11:45 ` [cocci] [PATCH 0/2] perf/x86/intel/pt: Adjustments for pt_pmu_hw_init() Markus Elfring
2023-03-29 10:12 ` [cocci] [PATCH] apparmor: Return directly after a failed kzalloc() in two functions Markus Elfring
2023-03-29 13:36 ` [cocci] [PATCH 0/3] lru_cache: Adjustments for lc_create() Markus Elfring
2023-03-29 13:40 ` [cocci] [PATCH 1/3] lru_cache: Return directly after a failed kzalloc() in lc_create() Markus Elfring
2023-03-29 13:42 ` [cocci] [PATCH 2/3] lru_cache: Improve two size determinations " Markus Elfring
2023-03-29 13:44 ` [cocci] [PATCH 3/3] lru_cache: Improve exception handling " Markus Elfring
2024-01-10 11:40 ` [cocci] [PATCH 0/3] lru_cache: Adjustments for lc_create() Markus Elfring
2023-03-29 15:46 ` [cocci] [PATCH] io_uring: Fix exception handling in io_ring_ctx_alloc() Markus Elfring
2024-01-10 11:23 ` [cocci] " Markus Elfring
2024-01-10 16:55 ` [cocci] [PATCH] " Gabriel Krisman Bertazi
2023-03-30 8:50 ` [cocci] [PATCH 0/4] overlayfs: Adjustments for ovl_fill_super() Markus Elfring
2023-03-30 8:55 ` [cocci] [PATCH 1/4] overlayfs: Return directly for two checks in ovl_fill_super() Markus Elfring
2023-03-30 8:57 ` [cocci] [PATCH 2/4] overlayfs: Improve two size determinations " Markus Elfring
2023-03-30 9:00 ` [cocci] [PATCH 3/4] overlayfs: Improve exception handling " Markus Elfring
2023-03-30 9:02 ` [cocci] [PATCH 4/4] overlayfs: Move some assignments for the variable “err” " Markus Elfring
2024-01-10 12:24 ` [cocci] [PATCH 0/4] overlayfs: Adjustments for ovl_fill_super() Markus Elfring
[not found] ` <CAOQ4uxiRaTQyT1nxeRD7B89=VuA+KKEqi01LL1kqfJ17-qKKpw@mail.gmail.com>
2024-01-10 13:01 ` [cocci] [0/4] " Markus Elfring
[not found] ` <CAOQ4uxjsuYy8BzgaHXaNa-S0+HZ_P-Fb1UEgOkbrdxQPz0Y6rQ@mail.gmail.com>
2024-01-10 13:33 ` Markus Elfring
2023-03-30 16:18 ` [cocci] [PATCH] squashfs: Improve exception handling in squashfs_decompressor_create() Markus Elfring
2024-01-05 20:32 ` Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6cbcf640-55e5-2f11-4a09-716fe681c0d2@web.de \
--to=markus.elfring@web.de \
--cc=cocci@inria.fr \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).