From: Kunwu Chan Date: Fri, 16 Aug 2024 02:07:40 +0000 (+0800) Subject: SUNRPC: Fix -Wformat-truncation warning X-Git-Tag: microblaze-v6.13~59^2~36 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=9090a7f78623b5312562861d54a4476d905c7c4c;p=linux-2.6-microblaze.git SUNRPC: Fix -Wformat-truncation warning 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); Signed-off-by: Kunwu Chan Suggested-by: NeilBrown Signed-off-by: Anna Schumaker --- diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 09f29a95f2bc..c7cea069a5df 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -546,7 +546,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) .connect_timeout = args->connect_timeout, .reconnect_timeout = args->reconnect_timeout, }; - char servername[48]; + char servername[RPC_MAXNETNAMELEN]; struct rpc_clnt *clnt; int i;