diff mbox series

[v2,2/2] x86: acpi: Add memset to initialize SPCR table

Message ID 20200916145753.684377-2-wolfgang.wallner@br-automation.com
State Accepted
Commit 40edea3a07ebb89e86c9bde8c94000c8f6613be7
Delegated to: Bin Meng
Headers show
Series [v2,1/2] x86: acpi: Fix calculation of DSDT length | expand

Commit Message

Wolfgang Wallner Sept. 16, 2020, 2:57 p.m. UTC
Add a missing memset to acpi_create_spcr().

The other acpi_create_xxxx() functions perform a memset on their
structures, acpi_create_spcr() does not and as a result the contents of
this table are partly uninitialized (and thus random after every reset).

Fixes: commit b288cd960072 ("x86: acpi: Generate SPCR table")

Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---

Changes in v2:
 - Removed unrelated whitespace change
 - Added Reviewed-by tags

 arch/x86/lib/acpi_table.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andy Shevchenko Sept. 16, 2020, 3:12 p.m. UTC | #1
On Wed, Sep 16, 2020 at 04:57:53PM +0200, Wolfgang Wallner wrote:
> Add a missing memset to acpi_create_spcr().
> 
> The other acpi_create_xxxx() functions perform a memset on their
> structures, acpi_create_spcr() does not and as a result the contents of
> this table are partly uninitialized (and thus random after every reset).

> Fixes: commit b288cd960072 ("x86: acpi: Generate SPCR table")
> 
> Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>

In tag block should not be any blank line, but I guess maintainer can fix this
when applying (i.o.w. no need to resend).

> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> ---
> 
> Changes in v2:
>  - Removed unrelated whitespace change
>  - Added Reviewed-by tags
> 
>  arch/x86/lib/acpi_table.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
> index 6b827bfa3f..c445aa6870 100644
> --- a/arch/x86/lib/acpi_table.c
> +++ b/arch/x86/lib/acpi_table.c
> @@ -252,6 +252,8 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)
>  	int space_id;
>  	int ret = -ENODEV;
>  
> +	memset((void *)spcr, 0, sizeof(struct acpi_spcr));
> +
>  	/* Fill out header fields */
>  	acpi_fill_header(header, "SPCR");
>  	header->length = sizeof(struct acpi_spcr);
> -- 
> 2.28.0
> 
>
Bin Meng Sept. 21, 2020, 1:43 a.m. UTC | #2
On Wed, Sep 16, 2020 at 11:12 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Wed, Sep 16, 2020 at 04:57:53PM +0200, Wolfgang Wallner wrote:
> > Add a missing memset to acpi_create_spcr().
> >
> > The other acpi_create_xxxx() functions perform a memset on their
> > structures, acpi_create_spcr() does not and as a result the contents of
> > this table are partly uninitialized (and thus random after every reset).
>
> > Fixes: commit b288cd960072 ("x86: acpi: Generate SPCR table")
> >
> > Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
>
> In tag block should not be any blank line, but I guess maintainer can fix this
> when applying (i.o.w. no need to resend).

Yep, normally I will fix such kinds of issues when applying. Thanks
for pointing it out.

>
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > ---
> >
> > Changes in v2:
> >  - Removed unrelated whitespace change
> >  - Added Reviewed-by tags
> >
> >  arch/x86/lib/acpi_table.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
> > index 6b827bfa3f..c445aa6870 100644
> > --- a/arch/x86/lib/acpi_table.c
> > +++ b/arch/x86/lib/acpi_table.c
> > @@ -252,6 +252,8 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)
> >       int space_id;
> >       int ret = -ENODEV;
> >
> > +     memset((void *)spcr, 0, sizeof(struct acpi_spcr));
> > +
> >       /* Fill out header fields */
> >       acpi_fill_header(header, "SPCR");
> >       header->length = sizeof(struct acpi_spcr);
> > --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Bin Meng Sept. 21, 2020, 1:46 a.m. UTC | #3
On Mon, Sep 21, 2020 at 9:43 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Wed, Sep 16, 2020 at 11:12 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Wed, Sep 16, 2020 at 04:57:53PM +0200, Wolfgang Wallner wrote:
> > > Add a missing memset to acpi_create_spcr().
> > >
> > > The other acpi_create_xxxx() functions perform a memset on their
> > > structures, acpi_create_spcr() does not and as a result the contents of
> > > this table are partly uninitialized (and thus random after every reset).
> >
> > > Fixes: commit b288cd960072 ("x86: acpi: Generate SPCR table")
> > >
> > > Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
> >
> > In tag block should not be any blank line, but I guess maintainer can fix this
> > when applying (i.o.w. no need to resend).
>
> Yep, normally I will fix such kinds of issues when applying. Thanks
> for pointing it out.

Fixed the tags format, and

>
> >
> > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Reviewed-by: Simon Glass <sjg@chromium.org>
> > >
> > > ---
> > >
> > > Changes in v2:
> > >  - Removed unrelated whitespace change
> > >  - Added Reviewed-by tags
> > >
> > >  arch/x86/lib/acpi_table.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
> > > index 6b827bfa3f..c445aa6870 100644
> > > --- a/arch/x86/lib/acpi_table.c
> > > +++ b/arch/x86/lib/acpi_table.c
> > > @@ -252,6 +252,8 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)
> > >       int space_id;
> > >       int ret = -ENODEV;
> > >
> > > +     memset((void *)spcr, 0, sizeof(struct acpi_spcr));
> > > +
> > >       /* Fill out header fields */
> > >       acpi_fill_header(header, "SPCR");
> > >       header->length = sizeof(struct acpi_spcr);
> > > --
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

applied to u-boot-x86, thanks!
diff mbox series

Patch

diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 6b827bfa3f..c445aa6870 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -252,6 +252,8 @@  static void acpi_create_spcr(struct acpi_spcr *spcr)
 	int space_id;
 	int ret = -ENODEV;
 
+	memset((void *)spcr, 0, sizeof(struct acpi_spcr));
+
 	/* Fill out header fields */
 	acpi_fill_header(header, "SPCR");
 	header->length = sizeof(struct acpi_spcr);