Re: [PATCH dlm/next 11/12] dlm: add nldlm net-namespace aware UAPI

kernel test robot
2024-08-20T07:40:26Z

Hi Alexander,

kernel test robot noticed the following build warnings:

[auto build test WARNING on teigland-dlm/next]
[also build test WARNING on next-20240820]
[cannot apply to gfs2/for-next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.11-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Alexander-Aring/dlm-introduce-dlm_find_lockspace_name/20240820-024440
base: https://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm.git next
patch link: https://lore.kernel.org/r/20240819183742.2263895-12-aahringo%40redhat.com
patch subject: [PATCH dlm/next 11/12] dlm: add nldlm net-namespace aware UAPI
config: x86_64-buildonly-randconfig-001-20240820 (https://download.01.org/0day-ci/archive/20240820/202408201509.g1VKeeOl-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240820/202408201509.g1VKeeOl-lkp@intel.com/reproduce)

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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408201509.g1VKeeOl-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/dlm/nldlm.c:195:2: warning: variable 'ls' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
195 | list_for_each_entry(ls_iter, &dn->lockspaces, list) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:779:7: note: expanded from macro 'list_for_each_entry'
779 | !list_entry_is_head(pos, head, member); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/dlm/nldlm.c:202:7: note: uninitialized use occurs here
202 | if (!ls) {
| ^~
fs/dlm/nldlm.c:195:2: note: remove the condition if it is always true
195 | list_for_each_entry(ls_iter, &dn->lockspaces, list) {
| ^
include/linux/list.h:779:7: note: expanded from macro 'list_for_each_entry'
779 | !list_entry_is_head(pos, head, member); \
| ^
fs/dlm/nldlm.c:185:23: note: initialize the variable 'ls' to silence this warning
185 | struct dlm_cfg_ls *ls, *ls_iter = NULL;
| ^
| = NULL
>> fs/dlm/nldlm.c:918:11: warning: variable 'log_level' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
918 | else if (dn->config.ci_log_debug)
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/dlm/nldlm.c:921:50: note: uninitialized use occurs here
921 | rv = nla_put_u32(skb, NLDLM_CFG_ATTR_LOG_LEVEL, log_level);
| ^~~~~~~~~
fs/dlm/nldlm.c:918:7: note: remove the 'if' if its condition is always true
918 | else if (dn->config.ci_log_debug)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
919 | log_level = NLDLM_LOG_LEVEL_DEBUG;
fs/dlm/nldlm.c:868:20: note: initialize the variable 'log_level' to silence this warning
868 | uint32_t log_level;
| ^
| = 0
2 warnings generated.

vim +195 fs/dlm/nldlm.c

181
182 static int nldlm_get_ls(struct sk_buff *msg, struct genl_info *info)
183 {
184 struct dlm_net *dn = dlm_pernet(sock_net(msg->sk));
> 185 struct dlm_cfg_ls *ls, *ls_iter = NULL;
186 char lsname[DLM_LOCKSPACE_LEN];
187 struct sk_buff *skb;
188 int rv;
189
190 rv = nldlm_parse_ls(info->attrs[NLDLM_ATTR_LS], lsname);
191 if (rv < 0)
192 return rv;
193
194 mutex_lock(&dn->cfg_lock);
> 195 list_for_each_entry(ls_iter, &dn->lockspaces, list) {
196 if (!strncmp(ls_iter->name, lsname, DLM_LOCKSPACE_LEN)) {
197 ls = ls_iter;
198 break;
199 }
200 }
201
202 if (!ls) {
203 rv = -ENOENT;
204 goto err;
205 }
206
207 skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
208 if (!skb) {
209 rv = -ENOMEM;
210 goto err;
211 }
212
213 rv = __nldlm_get_ls(skb, ls, info->snd_portid,
214 info->snd_seq, NULL, 0);
215 if (rv < 0) {
216 nlmsg_free(skb);
217 goto err;
218 }
219
220 rv = genlmsg_reply(skb, info);
221
222 err:
223 mutex_unlock(&dn->cfg_lock);
224 return rv;
225 }
226

--
0-DAY CI Kernel Test Service