Re: [linux-next:master 6914/8209] drivers/watchdog/watchdog_core.c:283:65: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 8

Guenter Roeck <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
On 7/21/26 21:05, Guenter Roeck wrote:
...
>>   > 283                snprintf(alias, sizeof(alias), "watchdog%d", id);
> 
> Sure, never mind that id can only be in the range of 0 .. MAX_DOGS - 1, or 1 .. 31.
> 
> I hate clueless compilers, but then I don't want to be bugged by this until
> I die either. Rasmus, any suggestion ? We could make alias a 20-byte string,
> or validate check the range of id. Not sure what would be less annoying.
> Any preference or other idea ?
> 

Never mind, using scnprintf() does the trick. I'll update the code.

Guenter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.