cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [cocci] Reconsidering kfree() calls for null pointers (with SmPL)
@ 2023-03-28 15:55 Markus Elfring
  2023-03-28 16:05 ` Vlastimil Babka
                   ` (7 more replies)
  0 siblings, 8 replies; 36+ messages in thread
From: Markus Elfring @ 2023-03-28 15:55 UTC (permalink / raw)
  To: cocci, kernel-janitors

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2024-01-22  7:51 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28 15:55 [cocci] Reconsidering kfree() calls for null pointers (with SmPL) Markus Elfring
2023-03-28 16:05 ` 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

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 NNTP newsgroup(s).