Skip to content

Commit d3722ff

Browse files
ptesariktehcaster
authored andcommitted
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>
1 parent dcb6fa3 commit d3722ff

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

mm/slub.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ static slab_flags_t slub_debug = DEBUG_DEFAULT_FLAGS;
978978
static slab_flags_t slub_debug;
979979
#endif
980980

981-
static char *slub_debug_string;
981+
static const char *slub_debug_string __ro_after_init;
982982
static int disable_higher_order_debug;
983983

984984
/*
@@ -1785,8 +1785,8 @@ static inline int free_consistency_checks(struct kmem_cache *s,
17851785
*
17861786
* returns the start of next block if there's any, or NULL
17871787
*/
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)
17901790
{
17911791
bool higher_order_disable = false;
17921792

@@ -1863,14 +1863,15 @@ parse_slub_debug_flags(char *str, slab_flags_t *flags, char **slabs, bool init)
18631863
return NULL;
18641864
}
18651865

1866-
static int __init setup_slub_debug(char *str)
1866+
static int __init setup_slub_debug(char *val)
18671867
{
18681868
slab_flags_t flags;
18691869
slab_flags_t global_flags;
1870-
char *saved_str;
1871-
char *slab_list;
1870+
const char *saved_str;
1871+
const char *slab_list;
18721872
bool global_slub_debug_changed = false;
18731873
bool slab_list_specified = false;
1874+
const char *str = val;
18741875

18751876
global_flags = DEBUG_DEFAULT_FLAGS;
18761877
if (*str++ != '=' || !*str)
@@ -1935,9 +1936,9 @@ __setup_param("slub_debug", slub_debug, setup_slub_debug, 0);
19351936
*/
19361937
slab_flags_t kmem_cache_flags(slab_flags_t flags, const char *name)
19371938
{
1938-
char *iter;
1939+
const char *iter;
19391940
size_t len;
1940-
char *next_block;
1941+
const char *next_block;
19411942
slab_flags_t block_flags;
19421943
slab_flags_t slub_debug_local = slub_debug;
19431944

@@ -1961,7 +1962,7 @@ slab_flags_t kmem_cache_flags(slab_flags_t flags, const char *name)
19611962
continue;
19621963
/* Found a block that has a slab list, search it */
19631964
while (*iter) {
1964-
char *end, *glob;
1965+
const char *end, *glob;
19651966
size_t cmplen;
19661967

19671968
end = strchrnul(iter, ',');

0 commit comments

Comments
 (0)