All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: drivers/nvme/target/pci-epf.c:1087:8-12: ERROR: reference preceded by free on line 1082
Date: Wed, 17 Dec 2025 01:36:06 +0800	[thread overview]
Message-ID: <202512170146.WfjrzWNF-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Damien Le Moal <dlemoal@kernel.org>
CC: Keith Busch <kbusch@kernel.org>
CC: Christoph Hellwig <hch@lst.de>
CC: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
CC: "Krzysztof Wilczyński" <kwilczynski@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   40fbbd64bba6c6e7a72885d2f59b6a3be9991eeb
commit: 0faa0fe6f90ea59b10d1b0f15ce0eb0c18eff186 nvmet: New NVMe PCI endpoint function target driver
date:   11 months ago
:::::: branch date: 10 hours ago
:::::: commit date: 11 months ago
config: sparc64-randconfig-r053-20251216 (https://download.01.org/0day-ci/archive/20251217/202512170146.WfjrzWNF-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 8.5.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: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202512170146.WfjrzWNF-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/nvme/target/pci-epf.c:1087:8-12: ERROR: reference preceded by free on line 1082

vim +1087 drivers/nvme/target/pci-epf.c

0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1033  
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1034  static int nvmet_pci_epf_iod_parse_sgl_segments(struct nvmet_pci_epf_ctrl *ctrl,
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1035  						struct nvmet_pci_epf_iod *iod)
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1036  {
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1037  	struct nvme_command *cmd = &iod->cmd;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1038  	struct nvme_sgl_desc seg = cmd->common.dptr.sgl;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1039  	struct nvme_sgl_desc *sgls = NULL;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1040  	int n = 0, i, nr_sgls;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1041  	int ret;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1042  
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1043  	/*
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1044  	 * We do not support inline data nor keyed SGLs, so we should be seeing
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1045  	 * only segment descriptors.
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1046  	 */
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1047  	if (seg.type != (NVME_SGL_FMT_SEG_DESC << 4) &&
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1048  	    seg.type != (NVME_SGL_FMT_LAST_SEG_DESC << 4)) {
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1049  		iod->status = NVME_SC_SGL_INVALID_TYPE | NVME_STATUS_DNR;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1050  		return -EIO;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1051  	}
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1052  
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1053  	while (seg.length) {
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1054  		sgls = nvmet_pci_epf_get_sgl_segment(ctrl, &seg, &nr_sgls);
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1055  		if (!sgls) {
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1056  			iod->status = NVME_SC_INTERNAL | NVME_STATUS_DNR;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1057  			return -EIO;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1058  		}
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1059  
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1060  		/* Grow the PCI segment table as needed. */
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1061  		ret = nvmet_pci_epf_alloc_iod_data_segs(iod, nr_sgls);
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1062  		if (ret) {
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1063  			iod->status = NVME_SC_INTERNAL | NVME_STATUS_DNR;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1064  			goto out;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1065  		}
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1066  
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1067  		/*
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1068  		 * Parse the SGL descriptors to build the PCI segment table,
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1069  		 * checking the descriptor type as we go.
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1070  		 */
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1071  		for (i = 0; i < nr_sgls; i++) {
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1072  			if (sgls[i].type != (NVME_SGL_FMT_DATA_DESC << 4)) {
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1073  				iod->status = NVME_SC_SGL_INVALID_TYPE |
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1074  					NVME_STATUS_DNR;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1075  				goto out;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1076  			}
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1077  			iod->data_segs[n].pci_addr = le64_to_cpu(sgls[i].addr);
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1078  			iod->data_segs[n].length = le32_to_cpu(sgls[i].length);
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1079  			n++;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1080  		}
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1081  
0faa0fe6f90ea59 Damien Le Moal 2025-01-04 @1082  		kfree(sgls);
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1083  	}
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1084  
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1085   out:
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1086  	if (iod->status != NVME_SC_SUCCESS) {
0faa0fe6f90ea59 Damien Le Moal 2025-01-04 @1087  		kfree(sgls);
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1088  		return -EIO;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1089  	}
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1090  
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1091  	return 0;
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1092  }
0faa0fe6f90ea59 Damien Le Moal 2025-01-04  1093  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2025-12-16 17:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-16 17:36 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-02-16 11:11 drivers/nvme/target/pci-epf.c:1087:8-12: ERROR: reference preceded by free on line 1082 kernel test robot

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=202512170146.WfjrzWNF-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=julia.lawall@inria.fr \
    --cc=oe-kbuild@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.