Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

slab: constify slab debug strings

Since the string passed to slab_debug is never modified, use pointers to
const char in all places where it is processed.

No functional changes intended.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
Reviewed-by: Christoph Lameter <cl@gentwo.org>
Link: https://patch.msgid.link/819095b921f6ae03bb54fd69ee4020e2a3aef675.1761324765.git.ptesarik@suse.com
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

authored by

Petr Tesarik and committed by
Vlastimil Babka
d3722ff5 dcb6fa37

+10 -9
+10 -9
mm/slub.c
··· 978 978 static slab_flags_t slub_debug; 979 979 #endif 980 980 981 - static char *slub_debug_string; 981 + static const char *slub_debug_string __ro_after_init; 982 982 static int disable_higher_order_debug; 983 983 984 984 /* ··· 1785 1785 * 1786 1786 * returns the start of next block if there's any, or NULL 1787 1787 */ 1788 - static char * 1789 - parse_slub_debug_flags(char *str, slab_flags_t *flags, char **slabs, bool init) 1788 + static const char * 1789 + parse_slub_debug_flags(const char *str, slab_flags_t *flags, const char **slabs, bool init) 1790 1790 { 1791 1791 bool higher_order_disable = false; 1792 1792 ··· 1863 1863 return NULL; 1864 1864 } 1865 1865 1866 - static int __init setup_slub_debug(char *str) 1866 + static int __init setup_slub_debug(char *val) 1867 1867 { 1868 1868 slab_flags_t flags; 1869 1869 slab_flags_t global_flags; 1870 - char *saved_str; 1871 - char *slab_list; 1870 + const char *saved_str; 1871 + const char *slab_list; 1872 1872 bool global_slub_debug_changed = false; 1873 1873 bool slab_list_specified = false; 1874 + const char *str = val; 1874 1875 1875 1876 global_flags = DEBUG_DEFAULT_FLAGS; 1876 1877 if (*str++ != '=' || !*str) ··· 1936 1935 */ 1937 1936 slab_flags_t kmem_cache_flags(slab_flags_t flags, const char *name) 1938 1937 { 1939 - char *iter; 1938 + const char *iter; 1940 1939 size_t len; 1941 - char *next_block; 1940 + const char *next_block; 1942 1941 slab_flags_t block_flags; 1943 1942 slab_flags_t slub_debug_local = slub_debug; 1944 1943 ··· 1962 1961 continue; 1963 1962 /* Found a block that has a slab list, search it */ 1964 1963 while (*iter) { 1965 - char *end, *glob; 1964 + const char *end, *glob; 1966 1965 size_t cmplen; 1967 1966 1968 1967 end = strchrnul(iter, ',');