Re: [SeaBIOS] GCC 7.1 warning in `tcgbios.c`: `'hleo.eventnumber' may be used uninitialized in this function`

2017-10-12 Thread Gerd Hoffmann
  Hi,

> Could you please cherry-pick that commit 
> 1ef72ab2f89ae61dcdb3f01323bd0a7dc978c2b9 to the stable branch 
> *origin/1.10-stable*?

Done.  I guess time for 1.10.3 (three commits since 1.10.2), which will
most likely be the last 1.10.x stable release with 1.11 being just
around the corner.

Any other suggestions for 1.10-stable?

cheers,
  Gerd


___
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios

Re: [SeaBIOS] GCC 7.1 warning in `tcgbios.c`: `'hleo.eventnumber' may be used uninitialized in this function`

2017-10-12 Thread Paul Menzel

Dear Kevin,


On 09/14/17 21:45, Kevin O'Connor wrote:

On Mon, Sep 11, 2017 at 01:40:45PM -0400, Stefan Berger wrote:

On 08/29/2017 02:45 PM, Kevin O'Connor wrote:

On Thu, Aug 10, 2017 at 08:52:06PM +0200, Paul Menzel wrote:



GCC 7.1 warns about a maybe uninitialized struct member.

```
src/tcgbios.c: In function 'tpm_interrupt_handler32':
src/tcgbios.c:1232:30: warning: 'hleo.eventnumber' may be used uninitialized
in this function [-Wmaybe-uninitialized]
   hleeo->eventnumber = hleo.eventnumber;
^~~~
Compiling whole program out/ccode32flat.o
In file included from out/ccode32flat.o.tmp.c:52:0:
./src/tcgbios.c: In function 'tpm_interrupt_handler32':
./src/tcgbios.c:1232:30: warning: 'hleo.eventnumber' may be used
uninitialized in this function [-Wmaybe-uninitialized]
   hleeo->eventnumber = hleo.eventnumber;
^~~~
```

It looks valid, as in the beginning the struct hleo is only declared.

```
1189 struct hleo hleo;
```


Agreed - the warning does look valid.  I think the patch below should
fix it.



--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -1186,7 +1186,6 @@ hash_log_extend_event_int(const struct hleei_short 
*hleei_s,
 struct hleeo *hleeo)
   {
   u32 rc = 0;
-struct hleo hleo;
   struct hleei_long *hleei_l = (struct hleei_long *)hleei_s;
   const void *logdataptr;
   u32 logdatalen;
@@ -1229,7 +1228,7 @@ hash_log_extend_event_int(const struct hleei_short 
*hleei_s,

   hleeo->opblength = sizeof(struct hleeo);
   hleeo->reserved  = 0;
-hleeo->eventnumber = hleo.eventnumber;
+hleeo->eventnumber = tpm_state.entry_count;
   memcpy(hleeo->digest, pcpes->digest, sizeof(hleeo->digest));

   err_exit:



Review-by: Stefan Berger 


Review*ed*.


Thanks - I committed this patch.


Could you please cherry-pick that commit 
1ef72ab2f89ae61dcdb3f01323bd0a7dc978c2b9 to the stable branch 
*origin/1.10-stable*?



Kind regards,

Paul

___
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios


Re: [SeaBIOS] GCC 7.1 warning in `tcgbios.c`: `'hleo.eventnumber' may be used uninitialized in this function`

2017-09-14 Thread Kevin O'Connor
On Mon, Sep 11, 2017 at 01:40:45PM -0400, Stefan Berger wrote:
> On 08/29/2017 02:45 PM, Kevin O'Connor wrote:
> > On Thu, Aug 10, 2017 at 08:52:06PM +0200, Paul Menzel wrote:
> > > Dear SeaBIOS folks,
> > > 
> > > 
> > > GCC 7.1 warns about a maybe uninitialized struct member.
> > > 
> > > ```
> > > src/tcgbios.c: In function 'tpm_interrupt_handler32':
> > > src/tcgbios.c:1232:30: warning: 'hleo.eventnumber' may be used 
> > > uninitialized
> > > in this function [-Wmaybe-uninitialized]
> > >   hleeo->eventnumber = hleo.eventnumber;
> > >^~~~
> > >Compiling whole program out/ccode32flat.o
> > > In file included from out/ccode32flat.o.tmp.c:52:0:
> > > ./src/tcgbios.c: In function 'tpm_interrupt_handler32':
> > > ./src/tcgbios.c:1232:30: warning: 'hleo.eventnumber' may be used
> > > uninitialized in this function [-Wmaybe-uninitialized]
> > >   hleeo->eventnumber = hleo.eventnumber;
> > >^~~~
> > > ```
> > > 
> > > It looks valid, as in the beginning the struct hleo is only declared.
> > > 
> > > ```
> > > 1189 struct hleo hleo;
> > > ```
> > > 
> > Agreed - the warning does look valid.  I think the patch below should
> > fix it.
> > 
> > -Kevin
> > 
> > 
> > --- a/src/tcgbios.c
> > +++ b/src/tcgbios.c
> > @@ -1186,7 +1186,6 @@ hash_log_extend_event_int(const struct hleei_short 
> > *hleei_s,
> > struct hleeo *hleeo)
> >   {
> >   u32 rc = 0;
> > -struct hleo hleo;
> >   struct hleei_long *hleei_l = (struct hleei_long *)hleei_s;
> >   const void *logdataptr;
> >   u32 logdatalen;
> > @@ -1229,7 +1228,7 @@ hash_log_extend_event_int(const struct hleei_short 
> > *hleei_s,
> > 
> >   hleeo->opblength = sizeof(struct hleeo);
> >   hleeo->reserved  = 0;
> > -hleeo->eventnumber = hleo.eventnumber;
> > +hleeo->eventnumber = tpm_state.entry_count;
> >   memcpy(hleeo->digest, pcpes->digest, sizeof(hleeo->digest));
> > 
> >   err_exit:
> > 
> 
> Review-by: Stefan Berger 

Thanks - I committed this patch.

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios


Re: [SeaBIOS] GCC 7.1 warning in `tcgbios.c`: `'hleo.eventnumber' may be used uninitialized in this function`

2017-09-11 Thread Stefan Berger

On 08/29/2017 02:45 PM, Kevin O'Connor wrote:

On Thu, Aug 10, 2017 at 08:52:06PM +0200, Paul Menzel wrote:

Dear SeaBIOS folks,


GCC 7.1 warns about a maybe uninitialized struct member.

```
src/tcgbios.c: In function 'tpm_interrupt_handler32':
src/tcgbios.c:1232:30: warning: 'hleo.eventnumber' may be used uninitialized
in this function [-Wmaybe-uninitialized]
  hleeo->eventnumber = hleo.eventnumber;
   ^~~~
   Compiling whole program out/ccode32flat.o
In file included from out/ccode32flat.o.tmp.c:52:0:
./src/tcgbios.c: In function 'tpm_interrupt_handler32':
./src/tcgbios.c:1232:30: warning: 'hleo.eventnumber' may be used
uninitialized in this function [-Wmaybe-uninitialized]
  hleeo->eventnumber = hleo.eventnumber;
   ^~~~
```

It looks valid, as in the beginning the struct hleo is only declared.

```
1189 struct hleo hleo;
```


Agreed - the warning does look valid.  I think the patch below should
fix it.

-Kevin


--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -1186,7 +1186,6 @@ hash_log_extend_event_int(const struct hleei_short 
*hleei_s,
struct hleeo *hleeo)
  {
  u32 rc = 0;
-struct hleo hleo;
  struct hleei_long *hleei_l = (struct hleei_long *)hleei_s;
  const void *logdataptr;
  u32 logdatalen;
@@ -1229,7 +1228,7 @@ hash_log_extend_event_int(const struct hleei_short 
*hleei_s,

  hleeo->opblength = sizeof(struct hleeo);
  hleeo->reserved  = 0;
-hleeo->eventnumber = hleo.eventnumber;
+hleeo->eventnumber = tpm_state.entry_count;
  memcpy(hleeo->digest, pcpes->digest, sizeof(hleeo->digest));

  err_exit:



Review-by: Stefan Berger 



___
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios


Re: [SeaBIOS] GCC 7.1 warning in `tcgbios.c`: `'hleo.eventnumber' may be used uninitialized in this function`

2017-08-29 Thread Kevin O'Connor
On Thu, Aug 10, 2017 at 08:52:06PM +0200, Paul Menzel wrote:
> Dear SeaBIOS folks,
> 
> 
> GCC 7.1 warns about a maybe uninitialized struct member.
> 
> ```
> src/tcgbios.c: In function 'tpm_interrupt_handler32':
> src/tcgbios.c:1232:30: warning: 'hleo.eventnumber' may be used uninitialized
> in this function [-Wmaybe-uninitialized]
>  hleeo->eventnumber = hleo.eventnumber;
>   ^~~~
>   Compiling whole program out/ccode32flat.o
> In file included from out/ccode32flat.o.tmp.c:52:0:
> ./src/tcgbios.c: In function 'tpm_interrupt_handler32':
> ./src/tcgbios.c:1232:30: warning: 'hleo.eventnumber' may be used
> uninitialized in this function [-Wmaybe-uninitialized]
>  hleeo->eventnumber = hleo.eventnumber;
>   ^~~~
> ```
> 
> It looks valid, as in the beginning the struct hleo is only declared.
> 
> ```
> 1189 struct hleo hleo;
> ```
> 

Agreed - the warning does look valid.  I think the patch below should
fix it.

-Kevin


--- a/src/tcgbios.c
+++ b/src/tcgbios.c
@@ -1186,7 +1186,6 @@ hash_log_extend_event_int(const struct hleei_short 
*hleei_s,
   struct hleeo *hleeo)
 {
 u32 rc = 0;
-struct hleo hleo;
 struct hleei_long *hleei_l = (struct hleei_long *)hleei_s;
 const void *logdataptr;
 u32 logdatalen;
@@ -1229,7 +1228,7 @@ hash_log_extend_event_int(const struct hleei_short 
*hleei_s,
 
 hleeo->opblength = sizeof(struct hleeo);
 hleeo->reserved  = 0;
-hleeo->eventnumber = hleo.eventnumber;
+hleeo->eventnumber = tpm_state.entry_count;
 memcpy(hleeo->digest, pcpes->digest, sizeof(hleeo->digest));
 
 err_exit:

___
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios


[SeaBIOS] GCC 7.1 warning in `tcgbios.c`: `'hleo.eventnumber' may be used uninitialized in this function`

2017-08-10 Thread Paul Menzel

Dear SeaBIOS folks,


GCC 7.1 warns about a maybe uninitialized struct member.

```
src/tcgbios.c: In function 'tpm_interrupt_handler32':
src/tcgbios.c:1232:30: warning: 'hleo.eventnumber' may be used 
uninitialized in this function [-Wmaybe-uninitialized]

 hleeo->eventnumber = hleo.eventnumber;
  ^~~~
  Compiling whole program out/ccode32flat.o
In file included from out/ccode32flat.o.tmp.c:52:0:
./src/tcgbios.c: In function 'tpm_interrupt_handler32':
./src/tcgbios.c:1232:30: warning: 'hleo.eventnumber' may be used 
uninitialized in this function [-Wmaybe-uninitialized]

 hleeo->eventnumber = hleo.eventnumber;
  ^~~~
```

It looks valid, as in the beginning the struct hleo is only declared.

```
1189 struct hleo hleo;
```


Kind regards,

Paul

___
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios