summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Garber <jgarber1@ualberta.ca>2019-08-05 11:49:35 -0600
committerCommit Bot <commit-bot@chromium.org>2019-08-06 22:10:40 +0000
commit3e15a29568e40ceb6393d092c6488ef25eb96256 (patch)
treec5d3ad474a77765d902efcc7b0c3fb5c8d2de0e8
parent2fb60500149a2757952332a8b0793099f9c6d077 (diff)
downloadvboot-3e15a29568e40ceb6393d092c6488ef25eb96256.tar.gz
cgpt: Fix format specifiers for uint64_t
These variables are all uint64_t, and so we need to use PRIu64 to ensure they are printed with the correct format specifier. BUG=none TEST=make clean && make runtests BRANCH=none Change-Id: Idb8fee0ef525d224670a9d2b3a7915be1b19fd21 Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Found-by: Coverity CID 199873, 199878, 199889 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1737200 Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--cgpt/cgpt_common.c4
-rw-r--r--cgpt/cgpt_create.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/cgpt/cgpt_common.c b/cgpt/cgpt_common.c
index 90fe45a2..db180bef 100644
--- a/cgpt/cgpt_common.c
+++ b/cgpt/cgpt_common.c
@@ -85,13 +85,13 @@ int Load(struct drive *drive, uint8_t **buf,
require(buf);
if (!sector_count || !sector_bytes) {
- Error("%s() failed at line %d: sector_count=%d, sector_bytes=%d\n",
+ Error("%s() failed at line %d: sector_count=%" PRIu64 ", sector_bytes=%" PRIu64 "\n",
__FUNCTION__, __LINE__, sector_count, sector_bytes);
return CGPT_FAILED;
}
/* Make sure that sector_bytes * sector_count doesn't roll over. */
if (sector_bytes > (UINT64_MAX / sector_count)) {
- Error("%s() failed at line %d: sector_count=%d, sector_bytes=%d\n",
+ Error("%s() failed at line %d: sector_count=%" PRIu64 ", sector_bytes=%" PRIu64 "\n",
__FUNCTION__, __LINE__, sector_count, sector_bytes);
return CGPT_FAILED;
}
diff --git a/cgpt/cgpt_create.c b/cgpt/cgpt_create.c
index e2b4b80b..77980bfc 100644
--- a/cgpt/cgpt_create.c
+++ b/cgpt/cgpt_create.c
@@ -15,7 +15,7 @@ static void AllocAndClear(uint8_t **buf, uint64_t size) {
} else {
*buf = calloc(1, size);
if (!*buf) {
- Error("Cannot allocate %u bytes.\n", size);
+ Error("Cannot allocate %" PRIu64 " bytes.\n", size);
abort();
}
}