Skip to content

Commit 199c6bd

Browse files
Paulo Alcantara (SUSE)smfrench
authored andcommitted
cifs: Get rid of kstrdup_const()'d paths
The DFS cache API is mostly used with heap allocated strings. Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 185352a commit 199c6bd

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎fs/cifs/dfs_cache.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static inline void flush_cache_ent(struct cache_entry *ce)
131131
return;
132132

133133
hlist_del_init_rcu(&ce->hlist);
134-
kfree_const(ce->path);
134+
kfree(ce->path);
135135
free_tgts(ce);
136136
cache_count--;
137137
call_rcu(&ce->rcu, free_cache_entry);
@@ -420,7 +420,7 @@ static struct cache_entry *alloc_cache_entry(const char *path,
420420
if (!ce)
421421
return ERR_PTR(-ENOMEM);
422422

423-
ce->path = kstrdup_const(path, GFP_KERNEL);
423+
ce->path = kstrndup(path, strlen(path), GFP_KERNEL);
424424
if (!ce->path) {
425425
kmem_cache_free(cache_slab, ce);
426426
return ERR_PTR(-ENOMEM);
@@ -430,7 +430,7 @@ static struct cache_entry *alloc_cache_entry(const char *path,
430430

431431
rc = copy_ref_data(refs, numrefs, ce, NULL);
432432
if (rc) {
433-
kfree_const(ce->path);
433+
kfree(ce->path);
434434
kmem_cache_free(cache_slab, ce);
435435
ce = ERR_PTR(rc);
436436
}

0 commit comments

Comments
 (0)