From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, Andrew Morton <akpm@linux-foundation.org>
Cc: Linux Memory Management List <linux-mm@kvack.org>,
Johannes Weiner <hannes@cmpxchg.org>,
kbuild-all@01.org, Waiman Long <longman@redhat.com>
Subject: Re: [kbuild] [mmotm:master 267/302] drivers/thermal/intel/int340x_thermal/processor_thermal_device.c:434 proc_thermal_pci_probe() error: 'proc_priv->soc_dts' dereferencing possible ERR_PTR()
Date: Sat, 15 Dec 2018 22:36:15 +0300 [thread overview]
Message-ID: <20181215193615.GB19692@kadam> (raw)
In-Reply-To: <20181215193359.GA19692@kadam>
I'm sorry Andrew, I have no idea why the system decided to email you
about this... Please ignore and I will follow up to make sure the bug
gets fixed.
regards,
dan carpenter
On Sat, Dec 15, 2018 at 10:33:59PM +0300, Dan Carpenter wrote:
> Hi Andrew,
>
> First bad commit (maybe != root cause):
>
> tree: git://git.cmpxchg.org/linux-mmotm.git master
> head: 6d5b029d523e959579667282e713106a29c193d2
> commit: c3b969e9bb7f00bd1fd376d28778fae406c991f5 [267/302] linux-next-git-rejects
>
> smatch warnings:
> drivers/thermal/intel/int340x_thermal/processor_thermal_device.c:434 proc_thermal_pci_probe() error: 'proc_priv->soc_dts' dereferencing possible ERR_PTR()
>
> git remote add mmotm git://git.cmpxchg.org/linux-mmotm.git
> git remote update mmotm
> git checkout c3b969e9bb7f00bd1fd376d28778fae406c991f5
> vim +434 drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
>
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 388
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 389 static int proc_thermal_pci_probe(struct pci_dev *pdev,
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 390 const struct pci_device_id *unused)
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 391 {
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 392 struct proc_thermal_device *proc_priv;
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 393 int ret;
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 394
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 395 if (proc_thermal_emum_mode == PROC_THERMAL_PLATFORM_DEV) {
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 396 dev_err(&pdev->dev, "error: enumerated as platform dev\n");
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 397 return -ENODEV;
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 398 }
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 399
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 400 ret = pci_enable_device(pdev);
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 401 if (ret < 0) {
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 402 dev_err(&pdev->dev, "error: could not enable device\n");
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 403 return ret;
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 404 }
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 405
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 406 ret = proc_thermal_add(&pdev->dev, &proc_priv);
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 407 if (ret) {
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 408 pci_disable_device(pdev);
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 409 return ret;
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 410 }
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 411
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 412 pci_set_drvdata(pdev, proc_priv);
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 413 proc_thermal_emum_mode = PROC_THERMAL_PCI;
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 414
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 415 if (pdev->device == PCI_DEVICE_ID_PROC_BSW_THERMAL) {
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 416 /*
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 417 * Enumerate additional DTS sensors available via IOSF.
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 418 * But we are not treating as a failure condition, if
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 419 * there are no aux DTSs enabled or fails. This driver
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 420 * already exposes sensors, which can be accessed via
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 421 * ACPI/MSR. So we don't want to fail for auxiliary DTSs.
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 422 */
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 423 proc_priv->soc_dts = intel_soc_dts_iosf_init(
>
> I guess intel_soc_dts_iosf_init() returns error pointers.
>
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 424 INTEL_SOC_DTS_INTERRUPT_MSI, 2, 0);
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 425
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 426 if (proc_priv->soc_dts && pdev->irq) {
>
> We check for NULL here. I don't know if it ever returns NULL or only
> error pointers.
>
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 427 ret = pci_enable_msi(pdev);
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 428 if (!ret) {
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 429 ret = request_threaded_irq(pdev->irq, NULL,
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 430 proc_thermal_pci_msi_irq,
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 431 IRQF_ONESHOT, "proc_thermal",
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 432 pdev);
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 433 if (ret) {
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 @434 intel_soc_dts_iosf_exit(
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 435 proc_priv->soc_dts);
>
> Smatch thinks it gets dereferenced inside the intel_soc_dts_iosf_exit()
> function.
>
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 436 pci_disable_msi(pdev);
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 437 proc_priv->soc_dts = NULL;
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 438 }
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 439 }
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 440 } else
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 441 dev_err(&pdev->dev, "No auxiliary DTSs enabled\n");
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 442 }
> 4d0dd6c1 drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2015-03-02 443
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 444 return 0;
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 445 }
> 47c93e6b drivers/thermal/int340x_thermal/processor_thermal_device.c Srinivas Pandruvada 2014-12-09 446
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
> _______________________________________________
> kbuild mailing list
> kbuild@lists.01.org
> https://lists.01.org/mailman/listinfo/kbuild
prev parent reply other threads:[~2018-12-15 19:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-15 19:33 [mmotm:master 267/302] drivers/thermal/intel/int340x_thermal/processor_thermal_device.c:434 proc_thermal_pci_probe() error: 'proc_priv->soc_dts' dereferencing possible ERR_PTR() Dan Carpenter
2018-12-15 19:36 ` Dan Carpenter [this message]
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=20181215193615.GB19692@kadam \
--to=dan.carpenter@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kbuild-all@01.org \
--cc=kbuild@01.org \
--cc=linux-mm@kvack.org \
--cc=longman@redhat.com \
/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.