diff options
author | Bobby Casey <bobbycasey@google.com> | 2022-06-16 17:32:06 -0400 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-07 21:25:39 +0000 |
commit | c25ffdb3164b0421d73f5258a71f3d371bfea623 (patch) | |
tree | 98fc0156448dd79b457f36896c385b5b04784733 /util | |
parent | 7eab3811962cde5b5c66a5952a4f7d9b1b41cd67 (diff) | |
download | chrome-ec-c25ffdb3164b0421d73f5258a71f3d371bfea623.tar.gz |
common: Conditionally support printf %l and %i modifiers
The libfp library prints some values with PRIx32 or PRId32 format
specifiers which, in their compilation environment, output "%lx" and
"%ld".
Unfortunately, support for printing any '%l' format in EC
code was deprecated in issuetracker.google.com/issues/172210614
after changing it from it being treated as a hard-coded 64-bit length.
There was concern that new code using %l with 32-bit values would be
cherry-picked to older branches without the updated printf. In these
cases, the older code would interpret that %l as 64-bit argument,
causing it to over-ingest arguments and potentially behave in an
undefined manner.
Printing 32-bit values with "%l" or "%i" is safe as long as we can
guarantee no legacy code will attempt to print using "%l" with a
64-bit value. The logic here is protected by a config flag that is
only enabled for FPMCU and FPMCU doesn't use long running release
branches.
A printf test is also added to ensure that only dartmonkey and
bloonchipper boards have long32 enabled.
BRANCH=none
BUG=b:234781655
BUG=b:234143158
TEST=./test/run_device_tests.py -b dartmonkey -t printf
TEST=./test/run_device_tests.py -b bloonchipper -t printf
TEST=make runhosttests
Signed-off-by: Bobby Casey <bobbycasey@google.com>
Change-Id: If432f507a31cc12a4c5c4bdcd07c6141407bd70d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3707743
Reviewed-by: Andrea Grandi <agrandi@google.com>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/config_allowed.txt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/config_allowed.txt b/util/config_allowed.txt index 58317b8384..0e352e7602 100644 --- a/util/config_allowed.txt +++ b/util/config_allowed.txt @@ -716,7 +716,7 @@ CONFIG_POWER_SIGNAL_INTERRUPT_STORM_DETECT_THRESHOLD CONFIG_POWER_SIGNAL_RUNTIME_CONFIG CONFIG_POWER_TRACK_HOST_SLEEP_STATE CONFIG_PRESERVE_LOGS -CONFIG_PRINTF_LEGACY_LI_FORMAT +CONFIG_PRINTF_LONG_IS_32BITS CONFIG_PRINT_IN_INT CONFIG_PROGRAM_MEMORY_BASE CONFIG_PROGRAM_MEMORY_BASE_LOAD |