[U-Boot] [PATCH 1/1] tpm: add missing va_end

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Jul 30 19:40:37 UTC 2017


va_start must always be matched by va_end.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 lib/tpm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/tpm.c b/lib/tpm.c
index fb520e3d73..d1cf5a8a16 100644
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -95,8 +95,10 @@ int pack_byte_string(uint8_t *str, size_t size, const char *format, ...)
 			return -1;
 		}
 
-		if (offset + length > size)
+		if (offset + length > size) {
+			va_end(args);
 			return -1;
+		}
 
 		switch (*format) {
 		case 'b':
@@ -163,6 +165,7 @@ int unpack_byte_string(const uint8_t *str, size_t size, const char *format, ...)
 			length = va_arg(args, uint32_t);
 			break;
 		default:
+			va_end(args);
 			debug("Couldn't recognize format string\n");
 			return -1;
 		}
-- 
2.13.2



More information about the U-Boot mailing list