summaryrefslogtreecommitdiff
path: root/src/lib/bootmem.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2021-01-15 17:48:11 -0800
committerPatrick Georgi <pgeorgi@google.com>2021-02-10 07:27:38 +0000
commite0f058ffa8309bd902802074418b5c6e0075a8aa (patch)
treeaf3373ea8c45fc48a2a5891913716b6c83ec7dec /src/lib/bootmem.c
parentcaef68968c872717b7efbeb428b3c3af973c2130 (diff)
coreboot_table: Use precision when printing lb_gpio name
The lb_gpio coreboot table entries use name fields fixed to 16 bytes. GCC will not allow creating a static initializer for such a field with a string of more than 16 characters... but exactly 16 characters is fine, meaning there's no room for the terminating NUL byte. The payloads (at least depthcharge) can deal with this as well because they're checking the size when looking at that table entry, but our printk("%16s") does not and will happily walk over the end until somewhere else in memory we finally find the next NUL byte. We should probably try to avoid strings of exactly 16 characters in this field anyway, just in case -- but since GCC doesn't warn about them they can easily slip back in. So solve this bug by also adding a precision field to the printk, which will make it stop overrunning the string. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ifd7beef00d828f9dc2faa4747eace6ac4ca41899 Reviewed-on: https://review.coreboot.org/c/coreboot/+/49496 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/lib/bootmem.c')
0 files changed, 0 insertions, 0 deletions