Linux ACPI
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: ming.m.lin@intel.com
Cc: "open list:ACPI" <linux-acpi@vger.kernel.org>,
	Len Brown <lenb@kernel.org>
Subject: re: ACPI: Add D3 cold state
Date: Mon, 30 May 2011 11:42:50 +0300	[thread overview]
Message-ID: <20110530084250.GM3099@shale.localdomain> (raw)

Commit 28c2103dad04 "ACPI: Add D3 cold state" introduced a read past
the end of the array in drivers/acpi/bus.c

   224  static int __acpi_bus_set_power(struct acpi_device *device, int state)
   225  {
   226          int result = 0;
   227          acpi_status status = AE_OK;
   228          char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
   229
   230          if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD))
                                                                   ^^^^^^^^^^^^^^^^^^
	This is 4 now.

   231                  return -EINVAL;
   232
   233          /* Make sure this is a valid target state */
   234
   235          if (state == device->power.state) {
   236                  ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
   237                                    state));
   238                  return 0;
   239          }
   240
   241          if (!device->power.states[state].flags.valid) {
                                   ^^^^^^^^^^^^^
	This array has 4 elements so we are one space past the end
	of the array.

   242                  printk(KERN_WARNING PREFIX "Device does not support D%d\n", state);
   243                  return -ENODEV;
   244          }

regards,
dan carpenter

             reply	other threads:[~2011-05-30  8:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-30  8:42 Dan Carpenter [this message]
2011-05-30  8:57 ` ACPI: Add D3 cold state Lin Ming
2011-05-30  9:14   ` Dan Carpenter
2011-05-30 13:10     ` Lin Ming

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=20110530084250.GM3099@shale.localdomain \
    --to=error27@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=ming.m.lin@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