aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorJim Rees <rees@umich.edu>2012-11-16 18:12:06 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-11-21 22:59:29 -0500
commitd751f748b359534d78e2b2e52b59d39f0e0540aa (patch)
treef4096c8e73033f9621a25150eb67c408e24ddf04 /fs/nfs/nfs4xdr.c
parentfe20d7d5eefb218b82033ba5c13cbcbd2a3d874c (diff)
NFS: Reduce stack use in encode_exchange_id()
encode_exchange_id() uses more stack space than necessary, giving a compile time warning. Reduce the size of the static buffer for implementation name. Signed-off-by: Jim Rees <rees@umich.edu> Reviewed-by: "Adamson, Dros" <Weston.Adamson@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 40836ee5dc3a..142aacb92459 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -270,6 +270,8 @@ static int nfs4_stat_to_errno(int);
270 270
271#if defined(CONFIG_NFS_V4_1) 271#if defined(CONFIG_NFS_V4_1)
272#define NFS4_MAX_MACHINE_NAME_LEN (64) 272#define NFS4_MAX_MACHINE_NAME_LEN (64)
273#define IMPL_NAME_LIMIT (sizeof(utsname()->sysname) + sizeof(utsname()->release) + \
274 sizeof(utsname()->version) + sizeof(utsname()->machine) + 8)
273 275
274#define encode_exchange_id_maxsz (op_encode_hdr_maxsz + \ 276#define encode_exchange_id_maxsz (op_encode_hdr_maxsz + \
275 encode_verifier_maxsz + \ 277 encode_verifier_maxsz + \
@@ -282,7 +284,7 @@ static int nfs4_stat_to_errno(int);
282 1 /* nii_domain */ + \ 284 1 /* nii_domain */ + \
283 XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + \ 285 XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + \
284 1 /* nii_name */ + \ 286 1 /* nii_name */ + \
285 XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + \ 287 XDR_QUADLEN(IMPL_NAME_LIMIT) + \
286 3 /* nii_date */) 288 3 /* nii_date */)
287#define decode_exchange_id_maxsz (op_decode_hdr_maxsz + \ 289#define decode_exchange_id_maxsz (op_decode_hdr_maxsz + \
288 2 /* eir_clientid */ + \ 290 2 /* eir_clientid */ + \
@@ -1713,7 +1715,7 @@ static void encode_exchange_id(struct xdr_stream *xdr,
1713 struct compound_hdr *hdr) 1715 struct compound_hdr *hdr)
1714{ 1716{
1715 __be32 *p; 1717 __be32 *p;
1716 char impl_name[NFS4_OPAQUE_LIMIT]; 1718 char impl_name[IMPL_NAME_LIMIT];
1717 int len = 0; 1719 int len = 0;
1718 1720
1719 encode_op_hdr(xdr, OP_EXCHANGE_ID, decode_exchange_id_maxsz, hdr); 1721 encode_op_hdr(xdr, OP_EXCHANGE_ID, decode_exchange_id_maxsz, hdr);
@@ -1728,7 +1730,7 @@ static void encode_exchange_id(struct xdr_stream *xdr,
1728 if (send_implementation_id && 1730 if (send_implementation_id &&
1729 sizeof(CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN) > 1 && 1731 sizeof(CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN) > 1 &&
1730 sizeof(CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN) 1732 sizeof(CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN)
1731 <= NFS4_OPAQUE_LIMIT + 1) 1733 <= sizeof(impl_name) + 1)
1732 len = snprintf(impl_name, sizeof(impl_name), "%s %s %s %s", 1734 len = snprintf(impl_name, sizeof(impl_name), "%s %s %s %s",
1733 utsname()->sysname, utsname()->release, 1735 utsname()->sysname, utsname()->release,
1734 utsname()->version, utsname()->machine); 1736 utsname()->version, utsname()->machine);