linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ima-evm-utils v2] pcr_tss: Fix compilation for old compilers
@ 2020-07-22 10:52 Petr Vorel
  2020-07-22 11:08 ` Mimi Zohar
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Vorel @ 2020-07-22 10:52 UTC (permalink / raw)
  To: linux-integrity; +Cc: Petr Vorel, Mimi Zohar

pcr_tss.c: In function 'pcr_selections_match':
pcr_tss.c:73:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < a->count; i++) {
  ^
pcr_tss.c:73:2: note: use option -std=c99 or -std=gnu99 to compile your code
pcr_tss.c:78:3: error: 'for' loop initial declarations are only allowed in C99 mode
   for (int j = 0; j < a->pcrSelections[i].sizeofSelect; j++) {
   ^

Fixes: 03f99ea ("ima-evm-utils: Add support for Intel TSS2 for PCR
reading")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
Add also j

 src/pcr_tss.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/pcr_tss.c b/src/pcr_tss.c
index 11b247b..feb1ff7 100644
--- a/src/pcr_tss.c
+++ b/src/pcr_tss.c
@@ -68,14 +68,17 @@ int tpm2_pcr_supported(void)
 
 static int pcr_selections_match(TPML_PCR_SELECTION *a, TPML_PCR_SELECTION *b)
 {
+	int i, j;
+
 	if (a->count != b->count)
 		return 0;
-	for (int i = 0; i < a->count; i++) {
+
+	for (i = 0; i < a->count; i++) {
 		if (a->pcrSelections[i].hash != b->pcrSelections[i].hash)
 			return 0;
 		if (a->pcrSelections[i].sizeofSelect != b->pcrSelections[i].sizeofSelect)
 			return 0;
-		for (int j = 0; j < a->pcrSelections[i].sizeofSelect; j++) {
+		for (j = 0; j < a->pcrSelections[i].sizeofSelect; j++) {
 			if (a->pcrSelections[i].pcrSelect[j] != b->pcrSelections[i].pcrSelect[j])
 				return 0;
 		}
-- 
2.27.0


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

* Re: [PATCH ima-evm-utils v2] pcr_tss: Fix compilation for old compilers
  2020-07-22 10:52 [PATCH ima-evm-utils v2] pcr_tss: Fix compilation for old compilers Petr Vorel
@ 2020-07-22 11:08 ` Mimi Zohar
  0 siblings, 0 replies; 2+ messages in thread
From: Mimi Zohar @ 2020-07-22 11:08 UTC (permalink / raw)
  To: Petr Vorel, linux-integrity; +Cc: Mimi Zohar

On Wed, 2020-07-22 at 12:52 +0200, Petr Vorel wrote:
> pcr_tss.c: In function 'pcr_selections_match':
> pcr_tss.c:73:2: error: 'for' loop initial declarations are only allowed in C99 mode
>   for (int i = 0; i < a->count; i++) {
>   ^
> pcr_tss.c:73:2: note: use option -std=c99 or -std=gnu99 to compile your code
> pcr_tss.c:78:3: error: 'for' loop initial declarations are only allowed in C99 mode
>    for (int j = 0; j < a->pcrSelections[i].sizeofSelect; j++) {
>    ^
> 
> Fixes: 03f99ea ("ima-evm-utils: Add support for Intel TSS2 for PCR
> reading")
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>

thanks,

Mimi

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

end of thread, other threads:[~2020-07-22 11:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 10:52 [PATCH ima-evm-utils v2] pcr_tss: Fix compilation for old compilers Petr Vorel
2020-07-22 11:08 ` Mimi Zohar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).