From 3f96c587e972e926badb50a15d4040e3ace8da62 Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Thu, 3 Sep 2020 15:46:47 -0600 Subject: [PATCH] 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 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2393193 Tested-by: Julius Werner Reviewed-by: Julius Werner Reviewed-by: Angel Pons Commit-Queue: Joel Kitching --- host/arch/arm/lib/crossystem_arch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);