summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2013-08-09 16:02:28 -0700
committerChromeBot <chrome-bot@google.com>2013-08-10 20:26:39 -0700
commit7aa250f2db901f523b050ca897237ec1e2be678a (patch)
tree688a4ca0819fb76b9b58afa0b8db7723cac91f9b
parent53710471b5e4fcfa83ccb628604819078b630a99 (diff)
downloadvboot-stabilize-falco-4537.91.B.tar.gz
In many cases format strings in vboot_reference do not match their parameters, which causes all kind of ugly results when examining debug output. Enforce proper format verification. CQ-DEPEND=CL:65396 BRANCH=pit BUG=none TEST=manual . compiled cleanly in vboot_reference, observed debug printouts making sense. Change-Id: I58d5ba1f9097ef9922fbaeb7a9946aadf5eb8617 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/65394
-rw-r--r--firmware/include/vboot_api.h3
-rw-r--r--firmware/lib/tpm_bootmode.c2
-rw-r--r--firmware/lib/vboot_api_kernel.c2
-rw-r--r--firmware/lib/vboot_audio.c13
4 files changed, 11 insertions, 9 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index dc8be1c4..3e0e4ec8 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -372,7 +372,8 @@ void VbExError(const char *format, ...);
/**
* Output a debug message. Supports printf()-style formatting.
*/
-void VbExDebug(const char *format, ...);
+void VbExDebug(const char *format, ...)
+ __attribute__ ((format (__printf__, 1, 2)));
/*****************************************************************************/
/* Memory (from utility.h) */
diff --git a/firmware/lib/tpm_bootmode.c b/firmware/lib/tpm_bootmode.c
index a8e1a7cc..0136bd9e 100644
--- a/firmware/lib/tpm_bootmode.c
+++ b/firmware/lib/tpm_bootmode.c
@@ -153,6 +153,6 @@ uint32_t SetTPMBootModeState(int developer_mode, int recovery_mode,
result = TlclExtend(BOOT_MODE_PCR, in_digest, out_digest);
VBDEBUG(("TPM: SetTPMBootModeState boot mode PCR out_digest "
"%02x %02x %02x %02x\n",
- out_digest, out_digest+1, out_digest+2, out_digest+3));
+ out_digest[0], out_digest[1], out_digest[2], out_digest[3]));
return result;
}
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index f253e92d..744ad4d6 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -145,7 +145,7 @@ int VbUserConfirms(VbCommonParams *cparams, int space_means_no)
return 1;
break;
case ' ':
- VBDEBUG(("%s() - Space (%s)\n", __func__,
+ VBDEBUG(("%s() - Space (%d)\n", __func__,
space_means_no));
if (space_means_no)
return 0;
diff --git a/firmware/lib/vboot_audio.c b/firmware/lib/vboot_audio.c
index 2694b0eb..8f96b68e 100644
--- a/firmware/lib/vboot_audio.c
+++ b/firmware/lib/vboot_audio.c
@@ -69,7 +69,7 @@ static void VbGetDevMusicNotes(VbAudioContext *audio, int use_short)
uint32_t this_msecs, on_msecs, total_msecs;
uint32_t count;
- VBDEBUG(("VbGetDevMusicNotes: use_short is %d, hdr is %lx, "
+ VBDEBUG(("VbGetDevMusicNotes: use_short is %d, hdr is %p, "
"maxsize is %d\n", use_short, hdr, maxsize));
if (use_short) {
@@ -112,7 +112,8 @@ static void VbGetDevMusicNotes(VbAudioContext *audio, int use_short)
if ((sizeof(VbDevMusicNote) > UINT_MAX / hdr->count) ||
(sizeof(hdr->count) >
UINT_MAX - hdr->count * sizeof(VbDevMusicNote))) {
- VBDEBUG(("VbGetDevMusicNotes: count=%d, just isn't right\n"));
+ VBDEBUG(("VbGetDevMusicNotes: count=%d, just isn't right\n",
+ hdr->count));
goto nope;
}
@@ -127,7 +128,7 @@ static void VbGetDevMusicNotes(VbAudioContext *audio, int use_short)
goto nope;
}
- VBDEBUG(("VbGetDevMusicNotes: custom notes struct at %lx\n", hdr));
+ VBDEBUG(("VbGetDevMusicNotes: custom notes struct at %p\n", hdr));
/*
* Measure the audible sound up to the first 22 seconds, being careful
@@ -148,7 +149,7 @@ static void VbGetDevMusicNotes(VbAudioContext *audio, int use_short)
}
/* We require at least one second of noise in the first 22 seconds */
- VBDEBUG(("VbGetDevMusicNotes: with %ld msecs of sound to begin\n",
+ VBDEBUG(("VbGetDevMusicNotes: with %d msecs of sound to begin\n",
on_msecs));
if (on_msecs < REQUIRED_NOISE_TIME)
goto nope;
@@ -157,7 +158,7 @@ static void VbGetDevMusicNotes(VbAudioContext *audio, int use_short)
* We'll also require that the total time be less than a minute. No
* real reason, it just gives us less to worry about.
*/
- VBDEBUG(("VbGetDevMusicNotes: lasting %ld msecs\n", total_msecs));
+ VBDEBUG(("VbGetDevMusicNotes: lasting %d msecs\n", total_msecs));
if (total_msecs > MAX_CUSTOM_DELAY) {
goto nope;
}
@@ -183,7 +184,7 @@ static void VbGetDevMusicNotes(VbAudioContext *audio, int use_short)
notebuf[hdr->count].msec = this_msecs;
notebuf[hdr->count].frequency = 0;
count++;
- VBDEBUG(("VbGetDevMusicNotes: adding %ld msecs of silence\n",
+ VBDEBUG(("VbGetDevMusicNotes: adding %d msecs of silence\n",
this_msecs));
}