linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: rafael.j.wysocki@intel.com
Cc: linux-acpi@vger.kernel.org
Subject: re: ACPI / hotplug / PCI: Rework the handling of eject requests
Date: Tue, 8 Jul 2014 16:37:45 +0300	[thread overview]
Message-ID: <20140708133745.GA20496@mwanda> (raw)

Hello Rafael J. Wysocki,

The patch dd2151be28b9: "ACPI / hotplug / PCI: Rework the handling of
eject requests" from Feb 4, 2014, leads to the following static
checker warning:

	drivers/acpi/scan.c:479 acpi_generic_hotplug_event()
	error: we previously assumed 'adev->handler' could be null (see line 473)

drivers/acpi/scan.c
   464  static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type)
   465  {
   466          switch (type) {
   467          case ACPI_NOTIFY_BUS_CHECK:
   468                  return acpi_scan_bus_check(adev);
   469          case ACPI_NOTIFY_DEVICE_CHECK:
   470                  return acpi_scan_device_check(adev);
   471          case ACPI_NOTIFY_EJECT_REQUEST:
   472          case ACPI_OST_EC_OSPM_EJECT:
   473                  if (adev->handler && !adev->handler->hotplug.enabled) {
                            ^^^^^^^^^^^^^
Patch adds new check.

   474                          dev_info(&adev->dev, "Eject disabled\n");
   475                          return -EPERM;
   476                  }
   477                  acpi_evaluate_ost(adev->handle, ACPI_NOTIFY_EJECT_REQUEST,
   478                                    ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
   479                  return acpi_scan_hot_remove(adev);

"adev->handler" is dereferenced without checking inside the call to
acpi_scan_hot_remove().

   480          }
   481          return -EINVAL;
   482  }

regards,
dan carpenter

                 reply	other threads:[~2014-07-08 13:37 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=20140708133745.GA20496@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).