From: Al Viro <viro@zeniv.linux.org.uk>
Date: Thu, 18 Mar 2021 15:47:35 -0400
Subject: [PATCH] cifs: make build_path_from_dentry() return const char *
Git-commit: 8e33cf20ceb7f6d7a7e039f9f82a0cd1f3a6f964
References: bsc#1190317
Patch-mainline: v5.13-rc1
... and adjust the callers.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Steve French <stfrench@microsoft.com>
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/cifsproto.h | 2 +-
fs/cifs/dir.c | 8 ++++----
fs/cifs/file.c | 8 ++++----
fs/cifs/inode.c | 16 ++++++++--------
fs/cifs/ioctl.c | 2 +-
fs/cifs/link.c | 8 ++++----
fs/cifs/readdir.c | 2 +-
fs/cifs/smb2ops.c | 2 +-
fs/cifs/xattr.c | 6 +++---
9 files changed, 27 insertions(+), 27 deletions(-)
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -69,7 +69,7 @@ extern int init_cifs_idmap(void);
extern void exit_cifs_idmap(void);
extern int init_cifs_spnego(void);
extern void exit_cifs_spnego(void);
-extern char *build_path_from_dentry(struct dentry *);
+extern const char *build_path_from_dentry(struct dentry *);
extern char *build_path_from_dentry_optional_prefix(struct dentry *direntry,
bool prefix);
extern char *cifs_build_path_to_root(struct smb_vol *vol,
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -77,7 +77,7 @@ cifs_build_path_to_root(struct smb_vol *
}
/* Note: caller must free return buffer */
-char *
+const char *
build_path_from_dentry(struct dentry *direntry)
{
struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
@@ -232,7 +232,7 @@ cifs_do_create(struct inode *inode, stru
int desired_access;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifs_tcon *tcon = tlink_tcon(tlink);
- char *full_path = NULL;
+ const char *full_path = NULL;
FILE_ALL_INFO *buf = NULL;
struct inode *newinode = NULL;
int disposition;
@@ -619,7 +619,7 @@ int cifs_mknod(struct inode *inode, stru
struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink;
struct cifs_tcon *tcon;
- char *full_path = NULL;
+ const char *full_path = NULL;
if (!old_valid_dev(device_number))
return -EINVAL;
@@ -660,7 +660,7 @@ cifs_lookup(struct inode *parent_dir_ino
struct tcon_link *tlink;
struct cifs_tcon *pTcon;
struct inode *newInode = NULL;
- char *full_path = NULL;
+ const char *full_path = NULL;
xid = get_xid();
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -527,7 +527,7 @@ int cifs_open(struct inode *inode, struc
struct cifs_tcon *tcon;
struct tcon_link *tlink;
struct cifsFileInfo *cfile = NULL;
- char *full_path = NULL;
+ const char *full_path = NULL;
bool posix_open_ok = false;
struct cifs_fid fid;
struct cifs_pending_open open;
@@ -686,7 +686,7 @@ cifs_reopen_file(struct cifsFileInfo *cf
struct TCP_Server_Info *server;
struct cifsInodeInfo *cinode;
struct inode *inode;
- char *full_path = NULL;
+ const char *full_path = NULL;
int desired_access;
int disposition = FILE_OPEN;
int create_options = CREATE_NOT_DIR;
@@ -2067,7 +2067,7 @@ cifs_get_writable_path(struct cifs_tcon
struct list_head *tmp;
struct cifsFileInfo *cfile;
struct cifsInodeInfo *cinode;
- char *full_path;
+ const char *full_path;
*ret_file = NULL;
@@ -2102,7 +2102,7 @@ cifs_get_readable_path(struct cifs_tcon
struct list_head *tmp;
struct cifsFileInfo *cfile;
struct cifsInodeInfo *cinode;
- char *full_path;
+ const char *full_path;
*ret_file = NULL;
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1404,7 +1404,7 @@ int cifs_unlink(struct inode *dir, struc
{
int rc = 0;
unsigned int xid;
- char *full_path = NULL;
+ const char *full_path = NULL;
struct inode *inode = d_inode(dentry);
struct cifsInodeInfo *cifs_inode;
struct super_block *sb = dir->i_sb;
@@ -1658,7 +1658,7 @@ int cifs_mkdir(struct inode *inode, stru
struct tcon_link *tlink;
struct cifs_tcon *tcon;
struct TCP_Server_Info *server;
- char *full_path;
+ const char *full_path;
cifs_dbg(FYI, "In cifs_mkdir, mode = %04ho inode = 0x%p\n",
mode, inode);
@@ -1730,7 +1730,7 @@ int cifs_rmdir(struct inode *inode, stru
struct tcon_link *tlink;
struct cifs_tcon *tcon;
struct TCP_Server_Info *server;
- char *full_path = NULL;
+ const char *full_path = NULL;
struct cifsInodeInfo *cifsInode;
cifs_dbg(FYI, "cifs_rmdir, inode = 0x%p\n", inode);
@@ -1864,8 +1864,8 @@ cifs_rename2(struct inode *source_dir, s
struct inode *target_dir, struct dentry *target_dentry,
unsigned int flags)
{
- char *from_name = NULL;
- char *to_name = NULL;
+ const char *from_name = NULL;
+ const char *to_name = NULL;
struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink;
struct cifs_tcon *tcon;
@@ -2098,7 +2098,7 @@ int cifs_revalidate_dentry_attr(struct d
int rc = 0;
struct inode *inode = d_inode(dentry);
struct super_block *sb = dentry->d_sb;
- char *full_path = NULL;
+ const char *full_path = NULL;
int count = 0;
if (inode == NULL)
@@ -2392,7 +2392,7 @@ cifs_setattr_unix(struct dentry *direntr
{
int rc;
unsigned int xid;
- char *full_path = NULL;
+ const char *full_path = NULL;
struct inode *inode = d_inode(direntry);
struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
@@ -2543,7 +2543,7 @@ cifs_setattr_nounix(struct dentry *diren
struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifsFileInfo *wfile;
struct cifs_tcon *tcon;
- char *full_path = NULL;
+ const char *full_path = NULL;
int rc = -EACCES;
__u32 dosattr = 0;
__u64 mode = NO_CHANGE_64;
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -42,7 +42,7 @@ static long cifs_ioctl_query_info(unsign
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
struct dentry *dentry = filep->f_path.dentry;
- unsigned char *path;
+ const unsigned char *path;
__le16 *utf16_path = NULL, root_path;
int rc = 0;
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -510,8 +510,8 @@ cifs_hardlink(struct dentry *old_file, s
{
int rc = -EACCES;
unsigned int xid;
- char *from_name = NULL;
- char *to_name = NULL;
+ const char *from_name = NULL;
+ const char *to_name = NULL;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink;
struct cifs_tcon *tcon;
@@ -600,7 +600,7 @@ cifs_get_link(struct dentry *direntry, s
{
int rc = -ENOMEM;
unsigned int xid;
- char *full_path = NULL;
+ const char *full_path = NULL;
char *target_path = NULL;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink = NULL;
@@ -668,7 +668,7 @@ cifs_symlink(struct inode *inode, struct
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink;
struct cifs_tcon *pTcon;
- char *full_path = NULL;
+ const char *full_path = NULL;
struct inode *newinode = NULL;
xid = get_xid();
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -941,7 +941,7 @@ int cifs_readdir(struct file *file, stru
char *tmp_buf = NULL;
char *end_of_smb;
unsigned int max_len;
- char *full_path = NULL;
+ const char *full_path = NULL;
xid = get_xid();
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -2163,7 +2163,7 @@ smb3_notify(const unsigned int xid, stru
struct cifs_open_parms oparms;
struct cifs_fid fid;
struct cifs_tcon *tcon;
- unsigned char *path = NULL;
+ const unsigned char *path = NULL;
__le16 *utf16_path = NULL;
u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
int rc = 0;
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -111,7 +111,7 @@ static int cifs_xattr_set(const struct x
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct tcon_link *tlink;
struct cifs_tcon *pTcon;
- char *full_path;
+ const char *full_path;
tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink))
@@ -296,7 +296,7 @@ static int cifs_xattr_get(const struct x
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct tcon_link *tlink;
struct cifs_tcon *pTcon;
- char *full_path;
+ const char *full_path;
tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink))
@@ -413,7 +413,7 @@ ssize_t cifs_listxattr(struct dentry *di
struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
struct tcon_link *tlink;
struct cifs_tcon *pTcon;
- char *full_path;
+ const char *full_path;
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
return -EOPNOTSUPP;