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 <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-02-25 18:57:19 +08:00 committed by David Sidrane
parent 44857ab30e
commit a2190aeb35
1 changed files with 2 additions and 2 deletions

View File

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