summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Garber <jgarber1@ualberta.ca>2020-09-03 15:46:47 -0600
committerCommit Bot <commit-bot@chromium.org>2020-09-30 22:37:32 +0000
commita2c3830db21f1c91928d41bd00ad74357ac2e010 (patch)
treeaee337c7fbcf281e7e20c284da226af855700ff7
parenta9576405b203f1e41b5067d978b08da72aaaa50f (diff)
downloadvboot-a2c3830db21f1c91928d41bd00ad74357ac2e010.tar.gz
host: Make gpiochip path buffer larger
The name of a gpiochip can in theory be up to NAME_MAX characters long (usually 255), which exceeds the length of the 30 byte buffer allocated for it. In practice we won't need more than the 30 bytes, but the smaller buffer trips a -Wformat-truncation warning from GCC that makes the build fail. Make the buffer bigger to keep GCC happy. BUG=none BRANCH=none TEST=make utillib compiles on BeagleBone Black Change-Id: I528f395033f58057846e717ff126e7a5dca504e3 Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2393193 Tested-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Commit-Queue: Joel Kitching <kitching@chromium.org> Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2441837 Reviewed-by: Martin Roth <martinroth@google.com> Tested-by: Martin Roth <martinroth@google.com> Commit-Queue: Martin Roth <martinroth@google.com>
-rw-r--r--host/arch/arm/lib/crossystem_arch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c
index d16012a2..f2e432f9 100644
--- a/host/arch/arm/lib/crossystem_arch.c
+++ b/host/arch/arm/lib/crossystem_arch.c
@@ -288,7 +288,7 @@ static int gpiod_read(const char *name, bool active_low)
return -1;
for (i = 0; i < max; i++) {
- char buf[30];
+ char buf[5 + NAME_MAX + 1];
int fd;
snprintf(buf, sizeof(buf), "/dev/%s", list[i]->d_name);