linux/tools/mm
Kaushlendra Kumar 4fa5b88e77 tools/mm/slabinfo: fix access to null terminator in string boundary
The current code incorrectly accesses buffer[strlen(buffer)], which points
to the null terminator ('\0') at the end of the string.  This is
technically out-of-bounds access since valid string content ends at index
strlen(buffer)-1.

Fix by:
1. Declaring strlen() result variable at function scope
2. Adding bounds check (len > 0) to handle empty strings
3. Using buffer[len-1] to correctly access the last character before
   the null terminator

[kaushlendra.kumar@intel.com: remove unnecessary blank line]
  Link: https://lkml.kernel.org/r/20250901044955.3902815-1-kaushlendra.kumar@intel.com
Link: https://lkml.kernel.org/r/20250830172022.1927448-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Acked-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-09-21 14:22:00 -07:00
..
.gitignore
Makefile tools/mm: rm thp_swap_allocator_test when make clean 2024-09-09 16:47:41 -07:00
page-types.c tools/mm: fix build warnings with musl-libc 2025-02-17 22:40:02 -08:00
page_owner_sort.c tools/mm: free the allocated memory 2024-11-06 20:11:17 -08:00
show_page_info.py tools/mm: add script to display page state for a given PID and VADDR 2025-07-09 22:41:53 -07:00
slabinfo-gnuplot.sh
slabinfo.c tools/mm/slabinfo: fix access to null terminator in string boundary 2025-09-21 14:22:00 -07:00
thp_swap_allocator_test.c tools/mm: introduce a tool to assess swap entry allocation for thp_swapout 2024-07-10 12:14:51 -07:00
thpmaps tools/mm: add thpmaps script to dump THP usage info 2024-02-22 10:24:38 -08:00