Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Leon Romanovsky <leonro@nvidia.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [leon-rdma:dmabuf-vfio 19/27] drivers/pci/p2pdma.c:265:11: warning: variable 'i' is uninitialized when used here
Date: Mon, 8 Sep 2025 13:29:32 +0800	[thread overview]
Message-ID: <202509081306.Kn97CBcM-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git dmabuf-vfio
head:   9bc352426598d13cfd13f8f031157d2b8a674cf1
commit: bb2ce8171dbc417c167ca7cabc946e39728432a5 [19/27] PCI/P2PDMA: Refactor to separate core P2P functionality from memory allocation
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20250908/202509081306.Kn97CBcM-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250908/202509081306.Kn97CBcM-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/202509081306.Kn97CBcM-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/pci/p2pdma.c:265:11: warning: variable 'i' is uninitialized when used here [-Wuninitialized]
     265 |         p2p->mem[i].owner = &pdev->dev;
         |                  ^
   drivers/pci/p2pdma.c:253:7: note: initialize the variable 'i' to silence this warning
     253 |         int i, ret;
         |              ^
         |               = 0
   1 warning generated.


vim +/i +265 drivers/pci/p2pdma.c

   241	
   242	/**
   243	 * pci_p2pdma_enable - Enable peer-to-peer DMA support for a PCI device
   244	 * @pdev: The PCI device to enable P2PDMA for
   245	 *
   246	 * This function initializes the peer-to-peer DMA infrastructure for a PCI
   247	 * device. It allocates and sets up the necessary data structures to support
   248	 * P2PDMA operations, including mapping type tracking.
   249	 */
   250	struct p2pdma_provider *pci_p2pdma_enable(struct pci_dev *pdev)
   251	{
   252		struct pci_p2pdma *p2p;
   253		int i, ret;
   254	
   255		p2p = rcu_dereference_protected(pdev->p2pdma, 1);
   256		if (p2p)
   257			/* PCI device was "rebound" to the driver */
   258			return p2p->mem;
   259	
   260		p2p = devm_kzalloc(&pdev->dev, sizeof(*p2p), GFP_KERNEL);
   261		if (!p2p)
   262			return ERR_PTR(-ENOMEM);
   263	
   264		xa_init(&p2p->map_types);
 > 265		p2p->mem[i].owner = &pdev->dev;
   266		for (i = 0; i < PCI_STD_NUM_BARS; i++)
   267			p2p->mem[i].bus_offset =
   268				pci_bus_address(pdev, i) - pci_resource_start(pdev, i);
   269	
   270		ret = devm_add_action_or_reset(&pdev->dev, pci_p2pdma_release, pdev);
   271		if (ret)
   272			goto out_p2p;
   273	
   274		rcu_assign_pointer(pdev->p2pdma, p2p);
   275		return p2p->mem;
   276	
   277	out_p2p:
   278		devm_kfree(&pdev->dev, p2p);
   279		return ERR_PTR(ret);
   280	}
   281	EXPORT_SYMBOL_GPL(pci_p2pdma_enable);
   282	

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

                 reply	other threads:[~2025-09-08  5:29 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=202509081306.Kn97CBcM-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=leonro@nvidia.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox