Re: [PATCH dlm/next 10/12] dlm: separate dlm lockspaces per net-namespace

Dan Carpenter
2024-08-20T19:22:12Z

Hi Alexander,

kernel test robot noticed the following build warnings:

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-11-aahringo%40redhat.com
patch subject: [PATCH dlm/next 10/12] dlm: separate dlm lockspaces per net-namespace
config: x86_64-randconfig-161-20240820 (https://download.01.org/0day-ci/archive/20240821/202408210031.QCBHr27k-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

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>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202408210031.QCBHr27k-lkp@intel.com/

New smatch warnings:
fs/dlm/lock.c:4989 dlm_receive_buffer() error: we previously assumed 'ls' could be null (see line 4988)

vim +/ls +4989 fs/dlm/lock.c

bde0f4dba584ae Alexander Aring 2024-08-19 4961 void dlm_receive_buffer(struct dlm_net *dn, const union dlm_packet *p,
bde0f4dba584ae Alexander Aring 2024-08-19 4962 int nodeid)
c36258b5925e6c David Teigland 2007-09-27 4963 {
1151935182b40b Alexander Aring 2023-08-01 4964 const struct dlm_header *hd = &p->header;
c36258b5925e6c David Teigland 2007-09-27 4965 struct dlm_ls *ls;
c36258b5925e6c David Teigland 2007-09-27 4966 int type = 0;
c36258b5925e6c David Teigland 2007-09-27 4967
c36258b5925e6c David Teigland 2007-09-27 4968 switch (hd->h_cmd) {
c36258b5925e6c David Teigland 2007-09-27 4969 case DLM_MSG:
00e99ccde75722 Alexander Aring 2022-04-04 4970 type = le32_to_cpu(p->message.m_type);
c36258b5925e6c David Teigland 2007-09-27 4971 break;
c36258b5925e6c David Teigland 2007-09-27 4972 case DLM_RCOM:
2f9dbeda8dc04b Alexander Aring 2022-04-04 4973 type = le32_to_cpu(p->rcom.rc_type);
c36258b5925e6c David Teigland 2007-09-27 4974 break;
c36258b5925e6c David Teigland 2007-09-27 4975 default:
c36258b5925e6c David Teigland 2007-09-27 4976 log_print("invalid h_cmd %d from %u", hd->h_cmd, nodeid);
c36258b5925e6c David Teigland 2007-09-27 4977 return;
c36258b5925e6c David Teigland 2007-09-27 4978 }
c36258b5925e6c David Teigland 2007-09-27 4979
3428785a65dabf Alexander Aring 2022-04-04 4980 if (le32_to_cpu(hd->h_nodeid) != nodeid) {
c36258b5925e6c David Teigland 2007-09-27 4981 log_print("invalid h_nodeid %d from %d lockspace %x",
3428785a65dabf Alexander Aring 2022-04-04 4982 le32_to_cpu(hd->h_nodeid), nodeid,
3428785a65dabf Alexander Aring 2022-04-04 4983 le32_to_cpu(hd->u.h_lockspace));
c36258b5925e6c David Teigland 2007-09-27 4984 return;
c36258b5925e6c David Teigland 2007-09-27 4985 }
c36258b5925e6c David Teigland 2007-09-27 4986
bde0f4dba584ae Alexander Aring 2024-08-19 4987 ls = dlm_find_lockspace_global(dn, le32_to_cpu(hd->u.h_lockspace));
c36258b5925e6c David Teigland 2007-09-27 @4988 if (!ls) {
bde0f4dba584ae Alexander Aring 2024-08-19 @4989 log_limit(ls, "dlm: invalid lockspace %u from %d cmd %d type %d\n",
^^
ls is NULL here so this doesn't work.

3428785a65dabf Alexander Aring 2022-04-04 4990 le32_to_cpu(hd->u.h_lockspace), nodeid,
3428785a65dabf Alexander Aring 2022-04-04 4991 hd->h_cmd, type);
c36258b5925e6c David Teigland 2007-09-27 4992
c36258b5925e6c David Teigland 2007-09-27 4993 if (hd->h_cmd == DLM_RCOM && type == DLM_RCOM_STATUS)
bde0f4dba584ae Alexander Aring 2024-08-19 4994 dlm_send_ls_not_ready(dn, nodeid, &p->rcom);
c36258b5925e6c David Teigland 2007-09-27 4995 return;
c36258b5925e6c David Teigland 2007-09-27 4996 }
c36258b5925e6c David Teigland 2007-09-27 4997
c36258b5925e6c David Teigland 2007-09-27 4998 /* this rwsem allows dlm_ls_stop() to wait for all dlm_recv threads to
c36258b5925e6c David Teigland 2007-09-27 4999 be inactive (in this ls) before transitioning to recovery mode */
c36258b5925e6c David Teigland 2007-09-27 5000
578acf9a87a875 Alexander Aring 2024-04-02 5001 read_lock_bh(&ls->ls_recv_active);
c36258b5925e6c David Teigland 2007-09-27 5002 if (hd->h_cmd == DLM_MSG)
eef7d739c218cb Al Viro 2008-01-25 5003 dlm_receive_message(ls, &p->message, nodeid);
f45307d395da7a Alexander Aring 2022-08-15 5004 else if (hd->h_cmd == DLM_RCOM)
eef7d739c218cb Al Viro 2008-01-25 5005 dlm_receive_rcom(ls, &p->rcom, nodeid);
f45307d395da7a Alexander Aring 2022-08-15 5006 else
f45307d395da7a Alexander Aring 2022-08-15 5007 log_error(ls, "invalid h_cmd %d from %d lockspace %x",
f45307d395da7a Alexander Aring 2022-08-15 5008 hd->h_cmd, nodeid, le32_to_cpu(hd->u.h_lockspace));
578acf9a87a875 Alexander Aring 2024-04-02 5009 read_unlock_bh(&ls->ls_recv_active);
c36258b5925e6c David Teigland 2007-09-27 5010
c36258b5925e6c David Teigland 2007-09-27 5011 dlm_put_lockspace(ls);
c36258b5925e6c David Teigland 2007-09-27 5012 }

--
0-DAY CI Kernel Test Service