aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xarray.c
diff options
context:
space:
mode:
authorKuan-Wei Chiu <[email protected]>2024-11-29 18:12:19 +0000
committerAndrew Morton <[email protected]>2025-01-13 04:20:57 +0000
commitec01e9d001fef6278df1900df4207c70166095b4 (patch)
tree9944ff3299595fac66d36fe5491d28dee6227882 /lib/xarray.c
parentRevert "vmstat: disable vmstat_work on vmstat_cpu_down_prep()" (diff)
downloadkernel-ec01e9d001fef6278df1900df4207c70166095b4.tar.gz
kernel-ec01e9d001fef6278df1900df4207c70166095b4.zip
lib min_heap: improve type safety in min_heap macros by using container_of
Patch series "lib min_heap: Improve min_heap safety, testing, and documentation". Improve the min heap implementation by enhancing type safety with container_of, reducing the attack vector by replacing test function calls with inline variants, and adding a brief API introduction in min_heap.h. It also includes author information in Documentation/core-api/min_heap.rst. This patch (of 4): The current implementation of min_heap macros uses explicit casting to min_heap_char *, which prevents the compiler from detecting incorrect pointer types. This can lead to errors if non-min_heap pointers are passed inadvertently. To enhance safety, replace all explicit casts to min_heap_char * with the use of container_of(&(_heap)->nr, min_heap_char, nr). This approach ensures that the _heap parameter is indeed a min_heap_char-compatible structure, allowing the compiler to catch improper usages. Link: https://lkml.kernel.org/r/[email protected] Link: https://lore.kernel.org/lkml/CAMuHMdVO5DPuD9HYWBFqKDHphx7+0BEhreUxtVC40A=8p6VAhQ@mail.gmail.com Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Kuan-Wei Chiu <[email protected]> Suggested-by: Geert Uytterhoeven <[email protected]> Cc: Ching-Chun (Jim) Huang <[email protected]> Cc: Jonathan Corbet <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'lib/xarray.c')
0 files changed, 0 insertions, 0 deletions