@@ -72,16 +72,6 @@ static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p)
7272 return xdr_ressize_check (rqstp , p );
7373}
7474
75- static __be32 * read_buf (struct xdr_stream * xdr , size_t nbytes )
76- {
77- __be32 * p ;
78-
79- p = xdr_inline_decode (xdr , nbytes );
80- if (unlikely (p == NULL ))
81- printk (KERN_WARNING "NFS: NFSv4 callback reply buffer overflowed!\n" );
82- return p ;
83- }
84-
8575static __be32 decode_string (struct xdr_stream * xdr , unsigned int * len ,
8676 const char * * str , size_t maxlen )
8777{
@@ -98,13 +88,13 @@ static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
9888{
9989 __be32 * p ;
10090
101- p = read_buf (xdr , 4 );
91+ p = xdr_inline_decode (xdr , 4 );
10292 if (unlikely (p == NULL ))
10393 return htonl (NFS4ERR_RESOURCE );
10494 fh -> size = ntohl (* p );
10595 if (fh -> size > NFS4_FHSIZE )
10696 return htonl (NFS4ERR_BADHANDLE );
107- p = read_buf (xdr , fh -> size );
97+ p = xdr_inline_decode (xdr , fh -> size );
10898 if (unlikely (p == NULL ))
10999 return htonl (NFS4ERR_RESOURCE );
110100 memcpy (& fh -> data [0 ], p , fh -> size );
@@ -117,11 +107,11 @@ static __be32 decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
117107 __be32 * p ;
118108 unsigned int attrlen ;
119109
120- p = read_buf (xdr , 4 );
110+ p = xdr_inline_decode (xdr , 4 );
121111 if (unlikely (p == NULL ))
122112 return htonl (NFS4ERR_RESOURCE );
123113 attrlen = ntohl (* p );
124- p = read_buf (xdr , attrlen << 2 );
114+ p = xdr_inline_decode (xdr , attrlen << 2 );
125115 if (unlikely (p == NULL ))
126116 return htonl (NFS4ERR_RESOURCE );
127117 if (likely (attrlen > 0 ))
@@ -135,7 +125,7 @@ static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
135125{
136126 __be32 * p ;
137127
138- p = read_buf (xdr , NFS4_STATEID_SIZE );
128+ p = xdr_inline_decode (xdr , NFS4_STATEID_SIZE );
139129 if (unlikely (p == NULL ))
140130 return htonl (NFS4ERR_RESOURCE );
141131 memcpy (stateid -> data , p , NFS4_STATEID_SIZE );
@@ -156,7 +146,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound
156146 status = decode_string (xdr , & hdr -> taglen , & hdr -> tag , CB_OP_TAGLEN_MAXSZ );
157147 if (unlikely (status != 0 ))
158148 return status ;
159- p = read_buf (xdr , 12 );
149+ p = xdr_inline_decode (xdr , 12 );
160150 if (unlikely (p == NULL ))
161151 return htonl (NFS4ERR_RESOURCE );
162152 hdr -> minorversion = ntohl (* p ++ );
@@ -176,7 +166,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound
176166static __be32 decode_op_hdr (struct xdr_stream * xdr , unsigned int * op )
177167{
178168 __be32 * p ;
179- p = read_buf (xdr , 4 );
169+ p = xdr_inline_decode (xdr , 4 );
180170 if (unlikely (p == NULL ))
181171 return htonl (NFS4ERR_RESOURCE_HDR );
182172 * op = ntohl (* p );
@@ -205,7 +195,7 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp,
205195 status = decode_delegation_stateid (xdr , & args -> stateid );
206196 if (unlikely (status != 0 ))
207197 return status ;
208- p = read_buf (xdr , 4 );
198+ p = xdr_inline_decode (xdr , 4 );
209199 if (unlikely (p == NULL ))
210200 return htonl (NFS4ERR_RESOURCE );
211201 args -> truncate = ntohl (* p );
@@ -227,7 +217,7 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
227217 __be32 status = 0 ;
228218 uint32_t iomode ;
229219
230- p = read_buf (xdr , 4 * sizeof (uint32_t ));
220+ p = xdr_inline_decode (xdr , 4 * sizeof (uint32_t ));
231221 if (unlikely (p == NULL ))
232222 return htonl (NFS4ERR_BADXDR );
233223
@@ -245,14 +235,14 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
245235 if (unlikely (status != 0 ))
246236 return status ;
247237
248- p = read_buf (xdr , 2 * sizeof (uint64_t ));
238+ p = xdr_inline_decode (xdr , 2 * sizeof (uint64_t ));
249239 if (unlikely (p == NULL ))
250240 return htonl (NFS4ERR_BADXDR );
251241 p = xdr_decode_hyper (p , & args -> cbl_range .offset );
252242 p = xdr_decode_hyper (p , & args -> cbl_range .length );
253243 return decode_layout_stateid (xdr , & args -> cbl_stateid );
254244 } else if (args -> cbl_recall_type == RETURN_FSID ) {
255- p = read_buf (xdr , 2 * sizeof (uint64_t ));
245+ p = xdr_inline_decode (xdr , 2 * sizeof (uint64_t ));
256246 if (unlikely (p == NULL ))
257247 return htonl (NFS4ERR_BADXDR );
258248 p = xdr_decode_hyper (p , & args -> cbl_fsid .major );
@@ -275,7 +265,7 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
275265 args -> ndevs = 0 ;
276266
277267 /* Num of device notifications */
278- p = read_buf (xdr , sizeof (uint32_t ));
268+ p = xdr_inline_decode (xdr , sizeof (uint32_t ));
279269 if (unlikely (p == NULL )) {
280270 status = htonl (NFS4ERR_BADXDR );
281271 goto out ;
@@ -298,7 +288,8 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
298288 for (i = 0 ; i < n ; i ++ ) {
299289 struct cb_devicenotifyitem * dev = & args -> devs [i ];
300290
301- p = read_buf (xdr , (4 * sizeof (uint32_t )) + NFS4_DEVICEID4_SIZE );
291+ p = xdr_inline_decode (xdr , (4 * sizeof (uint32_t )) +
292+ NFS4_DEVICEID4_SIZE );
302293 if (unlikely (p == NULL )) {
303294 status = htonl (NFS4ERR_BADXDR );
304295 goto err ;
@@ -329,7 +320,7 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
329320 p += XDR_QUADLEN (NFS4_DEVICEID4_SIZE );
330321
331322 if (dev -> cbd_layout_type == NOTIFY_DEVICEID4_CHANGE ) {
332- p = read_buf (xdr , sizeof (uint32_t ));
323+ p = xdr_inline_decode (xdr , sizeof (uint32_t ));
333324 if (unlikely (p == NULL )) {
334325 status = htonl (NFS4ERR_BADXDR );
335326 goto err ;
@@ -359,7 +350,7 @@ static __be32 decode_sessionid(struct xdr_stream *xdr,
359350{
360351 __be32 * p ;
361352
362- p = read_buf (xdr , NFS4_MAX_SESSIONID_LEN );
353+ p = xdr_inline_decode (xdr , NFS4_MAX_SESSIONID_LEN );
363354 if (unlikely (p == NULL ))
364355 return htonl (NFS4ERR_RESOURCE );
365356
@@ -379,13 +370,13 @@ static __be32 decode_rc_list(struct xdr_stream *xdr,
379370 goto out ;
380371
381372 status = htonl (NFS4ERR_RESOURCE );
382- p = read_buf (xdr , sizeof (uint32_t ));
373+ p = xdr_inline_decode (xdr , sizeof (uint32_t ));
383374 if (unlikely (p == NULL ))
384375 goto out ;
385376
386377 rc_list -> rcl_nrefcalls = ntohl (* p ++ );
387378 if (rc_list -> rcl_nrefcalls ) {
388- p = read_buf (xdr ,
379+ p = xdr_inline_decode (xdr ,
389380 rc_list -> rcl_nrefcalls * 2 * sizeof (uint32_t ));
390381 if (unlikely (p == NULL ))
391382 goto out ;
@@ -418,7 +409,7 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
418409 if (status )
419410 return status ;
420411
421- p = read_buf (xdr , 5 * sizeof (uint32_t ));
412+ p = xdr_inline_decode (xdr , 5 * sizeof (uint32_t ));
422413 if (unlikely (p == NULL ))
423414 return htonl (NFS4ERR_RESOURCE );
424415
@@ -461,7 +452,7 @@ static __be32 decode_recallany_args(struct svc_rqst *rqstp,
461452 uint32_t bitmap [2 ];
462453 __be32 * p , status ;
463454
464- p = read_buf (xdr , 4 );
455+ p = xdr_inline_decode (xdr , 4 );
465456 if (unlikely (p == NULL ))
466457 return htonl (NFS4ERR_BADXDR );
467458 args -> craa_objs_to_keep = ntohl (* p ++ );
@@ -480,7 +471,7 @@ static __be32 decode_recallslot_args(struct svc_rqst *rqstp,
480471 struct cb_recallslotargs * args = argp ;
481472 __be32 * p ;
482473
483- p = read_buf (xdr , 4 );
474+ p = xdr_inline_decode (xdr , 4 );
484475 if (unlikely (p == NULL ))
485476 return htonl (NFS4ERR_BADXDR );
486477 args -> crsa_target_highest_slotid = ntohl (* p ++ );
@@ -492,14 +483,14 @@ static __be32 decode_lockowner(struct xdr_stream *xdr, struct cb_notify_lock_arg
492483 __be32 * p ;
493484 unsigned int len ;
494485
495- p = read_buf (xdr , 12 );
486+ p = xdr_inline_decode (xdr , 12 );
496487 if (unlikely (p == NULL ))
497488 return htonl (NFS4ERR_BADXDR );
498489
499490 p = xdr_decode_hyper (p , & args -> cbnl_owner .clientid );
500491 len = be32_to_cpu (* p );
501492
502- p = read_buf (xdr , len );
493+ p = xdr_inline_decode (xdr , len );
503494 if (unlikely (p == NULL ))
504495 return htonl (NFS4ERR_BADXDR );
505496
@@ -537,7 +528,7 @@ static __be32 decode_write_response(struct xdr_stream *xdr,
537528 __be32 * p ;
538529
539530 /* skip the always zero field */
540- p = read_buf (xdr , 4 );
531+ p = xdr_inline_decode (xdr , 4 );
541532 if (unlikely (!p ))
542533 goto out ;
543534 p ++ ;
@@ -577,7 +568,7 @@ static __be32 decode_offload_args(struct svc_rqst *rqstp,
577568 return status ;
578569
579570 /* decode status */
580- p = read_buf (xdr , 4 );
571+ p = xdr_inline_decode (xdr , 4 );
581572 if (unlikely (!p ))
582573 goto out ;
583574 args -> error = ntohl (* p ++ );
@@ -943,10 +934,11 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp)
943934 };
944935 unsigned int nops = 0 ;
945936
946- xdr_init_decode (& xdr_in , & rqstp -> rq_arg , rqstp -> rq_arg .head [0 ].iov_base );
937+ xdr_init_decode (& xdr_in , & rqstp -> rq_arg ,
938+ rqstp -> rq_arg .head [0 ].iov_base , NULL );
947939
948940 p = (__be32 * )((char * )rqstp -> rq_res .head [0 ].iov_base + rqstp -> rq_res .head [0 ].iov_len );
949- xdr_init_encode (& xdr_out , & rqstp -> rq_res , p );
941+ xdr_init_encode (& xdr_out , & rqstp -> rq_res , p , NULL );
950942
951943 status = decode_compound_hdr_arg (& xdr_in , & hdr_arg );
952944 if (status == htonl (NFS4ERR_RESOURCE ))
0 commit comments