From a2190aeb35f00db5a925a26fb1e2d3977706ecb1 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sat, 25 Feb 2023 18:57:19 +0800 Subject: [PATCH] Fix error: '%s' directive output may be truncated writing up to 31 bytes into a region of size 27 [-Werror=format-truncation=] Signed-off-by: Xiang Xiao --- drivers/ioexpander/gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ioexpander/gpio.c b/drivers/ioexpander/gpio.c index a78ae99058..e5c1f1948a 100644 --- a/drivers/ioexpander/gpio.c +++ b/drivers/ioexpander/gpio.c @@ -563,7 +563,7 @@ static int gpio_ioctl(FAR struct file *filep, int cmd, unsigned long arg) int gpio_pin_register(FAR struct gpio_dev_s *dev, int minor) { - char devname[32]; + char devname[16]; snprintf(devname, sizeof(devname), "gpio%u", (unsigned int)minor); return gpio_pin_register_byname(dev, devname); @@ -663,7 +663,7 @@ int gpio_pin_register_byname(FAR struct gpio_dev_s *dev, int gpio_pin_unregister(FAR struct gpio_dev_s *dev, int minor) { - char devname[32]; + char devname[16]; snprintf(devname, sizeof(devname), "gpio%u", (unsigned int)minor); return gpio_pin_unregister_byname(dev, devname); }