All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: oe-kbuild@lists.linux.dev, Niklas Cassel <cassel@kernel.org>,
	lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-pci@vger.kernel.org, Frank Li <Frank.Li@nxp.com>
Subject: Re: [pci:endpoint 3/5] drivers/pci/endpoint/pci-epf-core.c:275 pci_epf_alloc_space() error: uninitialized symbol 'dev'.
Date: Fri, 9 Feb 2024 22:41:52 +0530	[thread overview]
Message-ID: <20240209171152.GI12035@thinkpad> (raw)
In-Reply-To: <7ea6ca33-3954-43a0-a9b8-a09c5db095b6@moroto.mountain>

On Fri, Feb 09, 2024 at 08:02:21PM +0300, Dan Carpenter wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git endpoint
> head:   f7bcec825e728e0baecf96118e36c8afb7b93f8a
> commit: 6441639b8a253254b00d7ccfbc2c9c67a8f42d10 [3/5] PCI: endpoint: Improve pci_epf_alloc_space() API
> config: x86_64-randconfig-161-20240209 (https://download.01.org/0day-ci/archive/20240210/202402100046.9zcFnPl3-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/202402100046.9zcFnPl3-lkp@intel.com/
> 

Thanks for the report. Fixed the issue in offending commit.

- Mani

> smatch warnings:
> drivers/pci/endpoint/pci-epf-core.c:275 pci_epf_alloc_space() error: uninitialized symbol 'dev'.
> 
> vim +/dev +275 drivers/pci/endpoint/pci-epf-core.c
> 
> 2a9a801620efac Kishon Vijay Abraham I 2019-03-25  259  void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar,
> e891becdccaa90 Niklas Cassel          2024-02-07  260  			  const struct pci_epc_features *epc_features,
> e891becdccaa90 Niklas Cassel          2024-02-07  261  			  enum pci_epc_interface_type type)
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  262  {
> 6441639b8a2532 Niklas Cassel          2024-02-07  263  	u64 bar_fixed_size = epc_features->bar_fixed_size[bar];
> e891becdccaa90 Niklas Cassel          2024-02-07  264  	size_t align = epc_features->align;
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  265  	struct pci_epf_bar *epf_bar;
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  266  	dma_addr_t phys_addr;
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  267  	struct pci_epc *epc;
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  268  	struct device *dev;
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  269  	void *space;
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  270  
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  271  	if (size < 128)
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  272  		size = 128;
> 2a9a801620efac Kishon Vijay Abraham I 2019-03-25  273  
> 6441639b8a2532 Niklas Cassel          2024-02-07  274  	if (bar_fixed_size && size > bar_fixed_size) {
> 6441639b8a2532 Niklas Cassel          2024-02-07 @275  		dev_err(dev, "requested BAR size is larger than fixed size\n");
> 
> "dev" is uninitialized.
> 
> 6441639b8a2532 Niklas Cassel          2024-02-07  276  		return NULL;
> 6441639b8a2532 Niklas Cassel          2024-02-07  277  	}
> 6441639b8a2532 Niklas Cassel          2024-02-07  278  
> 6441639b8a2532 Niklas Cassel          2024-02-07  279  	if (bar_fixed_size)
> 6441639b8a2532 Niklas Cassel          2024-02-07  280  		size = bar_fixed_size;
> 6441639b8a2532 Niklas Cassel          2024-02-07  281  
> 2a9a801620efac Kishon Vijay Abraham I 2019-03-25  282  	if (align)
> 2a9a801620efac Kishon Vijay Abraham I 2019-03-25  283  		size = ALIGN(size, align);
> 2a9a801620efac Kishon Vijay Abraham I 2019-03-25  284  	else
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  285  		size = roundup_pow_of_two(size);
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  286  
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  287  	if (type == PRIMARY_INTERFACE) {
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  288  		epc = epf->epc;
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  289  		epf_bar = epf->bar;
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  290  	} else {
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  291  		epc = epf->sec_epc;
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  292  		epf_bar = epf->sec_epc_bar;
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  293  	}
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  294  
> 63840ff5322373 Kishon Vijay Abraham I 2021-02-02  295  	dev = epc->dev.parent;
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  296  	space = dma_alloc_coherent(dev, size, &phys_addr, GFP_KERNEL);
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  297  	if (!space) {
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  298  		dev_err(dev, "failed to allocate mem space\n");
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  299  		return NULL;
> 5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  300  	}
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
> 

-- 
மணிவண்ணன் சதாசிவம்

  reply	other threads:[~2024-02-09 17:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09 17:02 [pci:endpoint 3/5] drivers/pci/endpoint/pci-epf-core.c:275 pci_epf_alloc_space() error: uninitialized symbol 'dev' Dan Carpenter
2024-02-09 17:11 ` Manivannan Sadhasivam [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-09 16:57 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=20240209171152.GI12035@thinkpad \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=Frank.Li@nxp.com \
    --cc=cassel@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --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.