Re: [PATCH] SUNRPC: Fix -Wformat-truncation warning
From: NeilBrown
Date: Fri Aug 16 2024 - 19:07:43 EST
On Sat, 17 Aug 2024, Andrew Lunn wrote:
> On Wed, Aug 14, 2024 at 05:38:53PM +0800, kunwu.chan@xxxxxxxxx wrote:
> > From: Kunwu Chan <chentao@xxxxxxxxxx>
> >
> > Increase size of the servername array to avoid truncated output warning.
> >
> > net/sunrpc/clnt.c:582:75: error:‘%s’ directive output may be truncated
> > writing up to 107 bytes into a region of size 48
> > [-Werror=format-truncation=]
> > 582 | snprintf(servername, sizeof(servername), "%s",
> > | ^~
> >
> > net/sunrpc/clnt.c:582:33: note:‘snprintf’ output
> > between 1 and 108 bytes into a destination of size 48
> > 582 | snprintf(servername, sizeof(servername), "%s",
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 583 | sun->sun_path);
>
> I think this has come up before, but i could be mis-remembering.
> Please could you do a search for the discussion. The fact it is not
> solved suggests to me it is not so simple to fix. Maybe there is some
> protocol implications here.
>
> Andrew
>
All I could find was
https://lore.kernel.org/all/1648103566-15528-1-git-send-email-baihaowen@xxxxxxxxx/
which essentially followed the same path as this conversation. The
patch was resubmitted using UNIX_PATH_MAX but never responded to by the
relevant maintainers.
There are no protocol implications. This string is only used for
informational messages.
NeilBrown