From: kernel test robot <lkp@intel.com>
To: Huiwen He <hehuiwen@kylinos.cn>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Steve French <stfrench@microsoft.com>,
ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: fs/smb/client/ioctl.c:135:2-7: WARNING: NULL check before some freeing functions is not needed.
Date: Sun, 16 Aug 2026 04:56:39 +0800 [thread overview]
Message-ID: <202608160402.0ffQDoCg-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3eb40771c00a8488fa6ed2cc1fe203477908bf38
commit: 5693347de107a26f68d1f43b25ff2e348c7229a9 smb/client: use writable handle for FS_IOC_SETFLAGS compression
date: 9 weeks ago
config: powerpc-randconfig-r053-20260812 (https://download.01.org/0day-ci/archive/20260816/202608160402.0ffQDoCg-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 12df34b8469b8095359de8c249cb1b2753fadeea)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 5693347de107 ("smb/client: use writable handle for FS_IOC_SETFLAGS compression")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608160402.0ffQDoCg-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> fs/smb/client/ioctl.c:135:2-7: WARNING: NULL check before some freeing functions is not needed.
vim +135 fs/smb/client/ioctl.c
69
70 static int cifs_set_compression_by_path(unsigned int xid, struct file *filep,
71 struct cifs_tcon *tcon)
72 {
73 struct inode *inode = file_inode(filep);
74 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
75 struct TCP_Server_Info *server = tcon->ses->server;
76 struct cifs_open_parms oparms;
77 struct cifs_open_info_data data = {};
78 struct cifsFileInfo *tmp_cfile = NULL;
79 struct cifs_fid fid = {};
80 const char *full_path;
81 __u32 oplock = 0;
82 u64 uniqueid;
83 void *page;
84 int rc;
85
86 if (!server->ops->open || !server->ops->close ||
87 !server->ops->query_file_info)
88 return -EOPNOTSUPP;
89
90 if (!(cifs_sb_flags(cifs_sb) & CIFS_MOUNT_SERVER_INUM) ||
91 cifs_sb->mnt_cifs_serverino_autodisabled)
92 return -EOPNOTSUPP;
93
94 if (d_unhashed(filep->f_path.dentry))
95 return -ESTALE;
96
97 page = alloc_dentry_path();
98 full_path = build_path_from_dentry(filep->f_path.dentry, page);
99 if (IS_ERR(full_path)) {
100 free_dentry_path(page);
101 return PTR_ERR(full_path);
102 }
103
104 oparms = CIFS_OPARMS(cifs_sb, tcon, full_path, FILE_WRITE_DATA |
105 FILE_READ_ATTRIBUTES,
106 FILE_OPEN, 0, ACL_NO_MODE);
107 oparms.fid = &fid;
108
109 rc = server->ops->open(xid, &oparms, &oplock, NULL);
110 if (rc)
111 goto out;
112
113 tmp_cfile = kzalloc_obj(*tmp_cfile);
114 if (!tmp_cfile) {
115 rc = -ENOMEM;
116 goto close;
117 }
118
119 tmp_cfile->fid = fid;
120 rc = server->ops->query_file_info(xid, tcon, tmp_cfile, &data);
121 if (rc)
122 goto close;
123
124 uniqueid = le64_to_cpu(data.fi.IndexNumber);
125 if (uniqueid != CIFS_I(inode)->uniqueid) {
126 rc = -ESTALE;
127 goto close;
128 }
129
130 rc = server->ops->set_compression(xid, tcon, tmp_cfile);
131
132 close:
133 server->ops->close(xid, tcon, &fid);
134 if (tmp_cfile)
> 135 kfree(tmp_cfile);
136 cifs_free_open_info(&data);
137 out:
138 free_dentry_path(page);
139 return rc;
140 }
141
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-08-15 20:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202608160402.0ffQDoCg-lkp@intel.com \
--to=lkp@intel.com \
--cc=chenxiaosong@kylinos.cn \
--cc=hehuiwen@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=stfrench@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®