diff options
author | Tom Hughes <tomhughes@chromium.org> | 2022-07-12 10:01:23 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-19 16:29:14 +0000 |
commit | 8d30a05ed74730fece3ebf0fd617426c565541ce (patch) | |
tree | 697a064455230b2358246d52feb5eb4e94ec2fd0 /fuzz | |
parent | e97b3e407b786e95cabef7977d42998f0ed13be8 (diff) | |
download | chrome-ec-8d30a05ed74730fece3ebf0fd617426c565541ce.tar.gz |
tree: Remove non-standard "%ph" printf format
The non-standard "%ph" format is replaced with snprintf_hex_buffer and
then using "%s" to print the resulting buffer.
Using standard format specifiers makes it easier to switch between the
"builtin" EC standard library and the C standard library provided by the
toolchain (or Zephyr).
BRANCH=none
BUG=b:238433667, b:234181908
TEST=Enable CONFIG_CMD_RAND in nocturne_fp/board.h
On icetower v0.1 with servo_micro and J-Trace:
Before change:
> rand
rand 8ab8b15090ca5ae83bdad671c906d51a5f2b98a359a4106054ee6b54a4087190
After change:
> rand
rand 2a8645235a31936a28b8d1b9c4948f46d39662e7fcb10a185ddb14c6a998e2eb
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I3bff928d32579440d7cdb27a75899e45159accfb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3759123
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'fuzz')
-rw-r--r-- | fuzz/host_command_fuzz.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fuzz/host_command_fuzz.c b/fuzz/host_command_fuzz.c index 856310db2b..b6c4c4685f 100644 --- a/fuzz/host_command_fuzz.c +++ b/fuzz/host_command_fuzz.c @@ -12,6 +12,7 @@ #include "console.h" #include "host_command.h" #include "host_test.h" +#include "printf.h" #include "task.h" #include "test_util.h" #include "timer.h" @@ -112,8 +113,11 @@ static int hostcmd_fill(const uint8_t *data, size_t size) * issues. */ if (first) { - ccprintf("Request: cmd=%04x data=%ph\n", req->command, - HEX_BUF(req_buf, req_size)); + char str_buf[hex_str_buf_size(req_size)]; + + snprintf_hex_buffer(str_buf, sizeof(str_buf), + HEX_BUF(req_buf, req_size)); + ccprintf("Request: cmd=%04x data=%s\n", req->command, str_buf); first = 0; } |