lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202212222333.vrYfUBqM-lkp@intel.com>
Date:   Fri, 23 Dec 2022 14:03:34 +0300
From:   Dan Carpenter <error27@...il.com>
To:     oe-kbuild@...ts.linux.dev, Sagi Grimberg <sagi@...mberg.me>
Cc:     lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
        linux-kernel@...r.kernel.org, Christoph Hellwig <hch@....de>
Subject: drivers/nvme/host/auth.c:950 nvme_auth_init_ctrl() warn: missing
 error code? 'ret'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9d2f6060fe4c3b49d0cdc1dce1c99296f33379c8
commit: aa36d711e945e65fa87410927800f01878a8faed nvme-auth: convert dhchap_auth_list to an array
config: i386-randconfig-m021-20221219
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <error27@...il.com>

smatch warnings:
drivers/nvme/host/auth.c:950 nvme_auth_init_ctrl() warn: missing error code? 'ret'

vim +/ret +950 drivers/nvme/host/auth.c

193a8c7e5f1a84 Sagi Grimberg   2022-11-13  931  int nvme_auth_init_ctrl(struct nvme_ctrl *ctrl)
f50fff73d620cd Hannes Reinecke 2022-06-27  932  {
aa36d711e945e6 Sagi Grimberg   2022-11-13  933  	struct nvme_dhchap_queue_context *chap;
aa36d711e945e6 Sagi Grimberg   2022-11-13  934  	int i, ret;
193a8c7e5f1a84 Sagi Grimberg   2022-11-13  935  
f50fff73d620cd Hannes Reinecke 2022-06-27  936  	mutex_init(&ctrl->dhchap_auth_mutex);
aa36d711e945e6 Sagi Grimberg   2022-11-13  937  	INIT_WORK(&ctrl->dhchap_auth_work, nvme_ctrl_auth_work);
f50fff73d620cd Hannes Reinecke 2022-06-27  938  	if (!ctrl->opts)
193a8c7e5f1a84 Sagi Grimberg   2022-11-13  939  		return 0;
193a8c7e5f1a84 Sagi Grimberg   2022-11-13  940  	ret = nvme_auth_generate_key(ctrl->opts->dhchap_secret,
193a8c7e5f1a84 Sagi Grimberg   2022-11-13  941  			&ctrl->host_key);
193a8c7e5f1a84 Sagi Grimberg   2022-11-13  942  	if (ret)
193a8c7e5f1a84 Sagi Grimberg   2022-11-13  943  		return ret;
193a8c7e5f1a84 Sagi Grimberg   2022-11-13  944  	ret = nvme_auth_generate_key(ctrl->opts->dhchap_ctrl_secret,
193a8c7e5f1a84 Sagi Grimberg   2022-11-13  945  			&ctrl->ctrl_key);
aa36d711e945e6 Sagi Grimberg   2022-11-13  946  	if (ret)
aa36d711e945e6 Sagi Grimberg   2022-11-13  947  		goto err_free_dhchap_secret;
aa36d711e945e6 Sagi Grimberg   2022-11-13  948  
aa36d711e945e6 Sagi Grimberg   2022-11-13  949  	if (!ctrl->opts->dhchap_secret && !ctrl->opts->dhchap_ctrl_secret)
aa36d711e945e6 Sagi Grimberg   2022-11-13 @950  		return ret;

Please return a literal here.  Either return -EINVAL or return 0;

aa36d711e945e6 Sagi Grimberg   2022-11-13  951  
aa36d711e945e6 Sagi Grimberg   2022-11-13  952  	ctrl->dhchap_ctxs = kvcalloc(ctrl_max_dhchaps(ctrl),
aa36d711e945e6 Sagi Grimberg   2022-11-13  953  				sizeof(*chap), GFP_KERNEL);
aa36d711e945e6 Sagi Grimberg   2022-11-13  954  	if (!ctrl->dhchap_ctxs) {
aa36d711e945e6 Sagi Grimberg   2022-11-13  955  		ret = -ENOMEM;
aa36d711e945e6 Sagi Grimberg   2022-11-13  956  		goto err_free_dhchap_ctrl_secret;
aa36d711e945e6 Sagi Grimberg   2022-11-13  957  	}
aa36d711e945e6 Sagi Grimberg   2022-11-13  958  
aa36d711e945e6 Sagi Grimberg   2022-11-13  959  	for (i = 0; i < ctrl_max_dhchaps(ctrl); i++) {
aa36d711e945e6 Sagi Grimberg   2022-11-13  960  		chap = &ctrl->dhchap_ctxs[i];
aa36d711e945e6 Sagi Grimberg   2022-11-13  961  		chap->qid = i;
aa36d711e945e6 Sagi Grimberg   2022-11-13  962  		chap->ctrl = ctrl;
aa36d711e945e6 Sagi Grimberg   2022-11-13  963  		INIT_WORK(&chap->auth_work, nvme_queue_auth_work);
aa36d711e945e6 Sagi Grimberg   2022-11-13  964  	}
aa36d711e945e6 Sagi Grimberg   2022-11-13  965  
aa36d711e945e6 Sagi Grimberg   2022-11-13  966  	return 0;
aa36d711e945e6 Sagi Grimberg   2022-11-13  967  err_free_dhchap_ctrl_secret:
aa36d711e945e6 Sagi Grimberg   2022-11-13  968  	nvme_auth_free_key(ctrl->ctrl_key);
aa36d711e945e6 Sagi Grimberg   2022-11-13  969  	ctrl->ctrl_key = NULL;
aa36d711e945e6 Sagi Grimberg   2022-11-13  970  err_free_dhchap_secret:
193a8c7e5f1a84 Sagi Grimberg   2022-11-13  971  	nvme_auth_free_key(ctrl->host_key);
193a8c7e5f1a84 Sagi Grimberg   2022-11-13  972  	ctrl->host_key = NULL;
193a8c7e5f1a84 Sagi Grimberg   2022-11-13  973  	return ret;
f50fff73d620cd Hannes Reinecke 2022-06-27  974  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ