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>
This commit is contained in:
Jacob Garber 2020-09-03 15:46:47 -06:00 committed by Commit Bot
parent 750da40fb8
commit 3f96c587e9
1 changed files with 1 additions and 1 deletions

View File

@ -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);