From: Dan Carpenter <dan.carpenter@oracle.com>
To: Sudeep.Holla@arm.com
Cc: linux-acpi@vger.kernel.org
Subject: [bug report] ACPI / processor_idle: Add support for Low Power Idle(LPI) states
Date: Tue, 25 Oct 2016 11:43:52 +0300 [thread overview]
Message-ID: <20161025084352.GA21587@elgon.mountain> (raw)
Hello Sudeep Holla,
The patch a36a7fecfe60: "ACPI / processor_idle: Add support for Low
Power Idle(LPI) states" from Jul 21, 2016, leads to the following
static checker warning:
drivers/acpi/processor_idle.c:1261 acpi_processor_setup_lpi_states()
warn: buffer overflow 'pr->power.lpi_states' 8 <= 9
drivers/acpi/processor_idle.c
1250 static int acpi_processor_setup_lpi_states(struct acpi_processor *pr)
1251 {
1252 int i;
1253 struct acpi_lpi_state *lpi;
1254 struct cpuidle_state *state;
1255 struct cpuidle_driver *drv = &acpi_idle_driver;
1256
1257 if (!pr->flags.has_lpi)
1258 return -EOPNOTSUPP;
1259
1260 for (i = 0; i < pr->power.count && i < CPUIDLE_STATE_MAX; i++) {
^^^^^^^^^^^^^^^^^
Should this be ACPI_PROCESSOR_MAX_POWER?
1261 lpi = &pr->power.lpi_states[i];
^^^^^^^^^^
because that's how many elements we have in this array.
1262
1263 state = &drv->states[i];
1264 snprintf(state->name, CPUIDLE_NAME_LEN, "LPI-%d", i);
1265 strlcpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN);
1266 state->exit_latency = lpi->wake_latency;
1267 state->target_residency = lpi->min_residency;
1268 if (lpi->arch_flags)
1269 state->flags |= CPUIDLE_FLAG_TIMER_STOP;
1270 state->enter = acpi_idle_lpi_enter;
1271 drv->safe_state_index = i;
1272 }
1273
1274 drv->state_count = i;
1275
1276 return 0;
1277 }
regards,
dan carpenter
next reply other threads:[~2016-10-25 8:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-25 8:43 Dan Carpenter [this message]
2016-10-25 9:12 ` [bug report] ACPI / processor_idle: Add support for Low Power Idle(LPI) states Sudeep Holla
2016-10-25 9:23 ` Dan Carpenter
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=20161025084352.GA21587@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=Sudeep.Holla@arm.com \
--cc=linux-acpi@vger.kernel.org \
/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.