public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: Fixes device power states array overflow
@ 2011-05-30 13:42 Lin Ming
  2011-05-31 21:09 ` Oldřich Jedlička
  0 siblings, 1 reply; 3+ messages in thread
From: Lin Ming @ 2011-05-30 13:42 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-acpi, Dan Carpenter

Commit 28c2103 added new state ACPI_STATE_D3_COLD, so the device power
states array must be expanded by one also.

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
---
 include/acpi/acpi_bus.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 3a10ef5..ff246e8 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -210,7 +210,7 @@ struct acpi_device_power_state {
 struct acpi_device_power {
 	int state;		/* Current state */
 	struct acpi_device_power_flags flags;
-	struct acpi_device_power_state states[4];	/* Power states (D0-D3) */
+	struct acpi_device_power_state states[5];	/* Power states (D0-D3Cold) */
 };
 
 /* Performance Management */
-- 
1.7.2.3




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: Fixes device power states array overflow
  2011-05-30 13:42 [PATCH] ACPI: Fixes device power states array overflow Lin Ming
@ 2011-05-31 21:09 ` Oldřich Jedlička
  2011-06-01 15:55   ` Lin Ming
  0 siblings, 1 reply; 3+ messages in thread
From: Oldřich Jedlička @ 2011-05-31 21:09 UTC (permalink / raw)
  To: Lin Ming; +Cc: Len Brown, linux-acpi, Dan Carpenter

Hi Lin,

On Monday 30 May 2011 at 15:42:41, Lin Ming wrote:
> Commit 28c2103 added new state ACPI_STATE_D3_COLD, so the device power
> states array must be expanded by one also.
> 
> Reported-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Lin Ming <ming.m.lin@intel.com>
> ---
>  include/acpi/acpi_bus.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index 3a10ef5..ff246e8 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -210,7 +210,7 @@ struct acpi_device_power_state {
>  struct acpi_device_power {
>  	int state;		/* Current state */
>  	struct acpi_device_power_flags flags;
> -	struct acpi_device_power_state states[4];	/* Power states (D0-D3) */
> +	struct acpi_device_power_state states[5];	/* Power states (D0-D3Cold) 
*/

Wouldn't it be better to use some constant, so that the same problem would not 
appear again in future - something like ACPI_D_STATE_COUNT or (maybe better) 
ACPI_D_STATES_MAX+1 instead of magic number 5?

Cheers,
Oldřich.


>  };
> 
>  /* Performance Management */
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: Fixes device power states array overflow
  2011-05-31 21:09 ` Oldřich Jedlička
@ 2011-06-01 15:55   ` Lin Ming
  0 siblings, 0 replies; 3+ messages in thread
From: Lin Ming @ 2011-06-01 15:55 UTC (permalink / raw)
  To: Old; +Cc: Len Brown, linux-acpi@vger.kernel.org, Dan Carpenter

在 2011-06-01三的 05:09 +0800,Oldřich Jedlička写道:
> Hi Lin,
> 
> On Monday 30 May 2011 at 15:42:41, Lin Ming wrote:
> > Commit 28c2103 added new state ACPI_STATE_D3_COLD, so the device power
> > states array must be expanded by one also.
> > 
> > Reported-by: Dan Carpenter <error27@gmail.com>
> > Signed-off-by: Lin Ming <ming.m.lin@intel.com>
> > ---
> >  include/acpi/acpi_bus.h |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> > index 3a10ef5..ff246e8 100644
> > --- a/include/acpi/acpi_bus.h
> > +++ b/include/acpi/acpi_bus.h
> > @@ -210,7 +210,7 @@ struct acpi_device_power_state {
> >  struct acpi_device_power {
> >  	int state;		/* Current state */
> >  	struct acpi_device_power_flags flags;
> > -	struct acpi_device_power_state states[4];	/* Power states (D0-D3) */
> > +	struct acpi_device_power_state states[5];	/* Power states (D0-D3Cold) 
> */
> 
> Wouldn't it be better to use some constant, so that the same problem would not 
> appear again in future - something like ACPI_D_STATE_COUNT or (maybe better) 
> ACPI_D_STATES_MAX+1 instead of magic number 5?

Nice catch, I have updated the patch.

Thanks.

> 
> Cheers,
> Oldřich.
> 
> 
> >  };
> > 
> >  /* Performance Management */


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-01 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-30 13:42 [PATCH] ACPI: Fixes device power states array overflow Lin Ming
2011-05-31 21:09 ` Oldřich Jedlička
2011-06-01 15:55   ` Lin Ming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox