@@ -72,16 +72,6 @@ static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p)
72
72
return xdr_ressize_check (rqstp , p );
73
73
}
74
74
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
-
85
75
static __be32 decode_string (struct xdr_stream * xdr , unsigned int * len ,
86
76
const char * * str , size_t maxlen )
87
77
{
@@ -98,13 +88,13 @@ static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
98
88
{
99
89
__be32 * p ;
100
90
101
- p = read_buf (xdr , 4 );
91
+ p = xdr_inline_decode (xdr , 4 );
102
92
if (unlikely (p == NULL ))
103
93
return htonl (NFS4ERR_RESOURCE );
104
94
fh -> size = ntohl (* p );
105
95
if (fh -> size > NFS4_FHSIZE )
106
96
return htonl (NFS4ERR_BADHANDLE );
107
- p = read_buf (xdr , fh -> size );
97
+ p = xdr_inline_decode (xdr , fh -> size );
108
98
if (unlikely (p == NULL ))
109
99
return htonl (NFS4ERR_RESOURCE );
110
100
memcpy (& fh -> data [0 ], p , fh -> size );
@@ -117,11 +107,11 @@ static __be32 decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
117
107
__be32 * p ;
118
108
unsigned int attrlen ;
119
109
120
- p = read_buf (xdr , 4 );
110
+ p = xdr_inline_decode (xdr , 4 );
121
111
if (unlikely (p == NULL ))
122
112
return htonl (NFS4ERR_RESOURCE );
123
113
attrlen = ntohl (* p );
124
- p = read_buf (xdr , attrlen << 2 );
114
+ p = xdr_inline_decode (xdr , attrlen << 2 );
125
115
if (unlikely (p == NULL ))
126
116
return htonl (NFS4ERR_RESOURCE );
127
117
if (likely (attrlen > 0 ))
@@ -135,7 +125,7 @@ static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
135
125
{
136
126
__be32 * p ;
137
127
138
- p = read_buf (xdr , NFS4_STATEID_SIZE );
128
+ p = xdr_inline_decode (xdr , NFS4_STATEID_SIZE );
139
129
if (unlikely (p == NULL ))
140
130
return htonl (NFS4ERR_RESOURCE );
141
131
memcpy (stateid -> data , p , NFS4_STATEID_SIZE );
@@ -156,7 +146,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound
156
146
status = decode_string (xdr , & hdr -> taglen , & hdr -> tag , CB_OP_TAGLEN_MAXSZ );
157
147
if (unlikely (status != 0 ))
158
148
return status ;
159
- p = read_buf (xdr , 12 );
149
+ p = xdr_inline_decode (xdr , 12 );
160
150
if (unlikely (p == NULL ))
161
151
return htonl (NFS4ERR_RESOURCE );
162
152
hdr -> minorversion = ntohl (* p ++ );
@@ -176,7 +166,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound
176
166
static __be32 decode_op_hdr (struct xdr_stream * xdr , unsigned int * op )
177
167
{
178
168
__be32 * p ;
179
- p = read_buf (xdr , 4 );
169
+ p = xdr_inline_decode (xdr , 4 );
180
170
if (unlikely (p == NULL ))
181
171
return htonl (NFS4ERR_RESOURCE_HDR );
182
172
* op = ntohl (* p );
@@ -205,7 +195,7 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp,
205
195
status = decode_delegation_stateid (xdr , & args -> stateid );
206
196
if (unlikely (status != 0 ))
207
197
return status ;
208
- p = read_buf (xdr , 4 );
198
+ p = xdr_inline_decode (xdr , 4 );
209
199
if (unlikely (p == NULL ))
210
200
return htonl (NFS4ERR_RESOURCE );
211
201
args -> truncate = ntohl (* p );
@@ -227,7 +217,7 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
227
217
__be32 status = 0 ;
228
218
uint32_t iomode ;
229
219
230
- p = read_buf (xdr , 4 * sizeof (uint32_t ));
220
+ p = xdr_inline_decode (xdr , 4 * sizeof (uint32_t ));
231
221
if (unlikely (p == NULL ))
232
222
return htonl (NFS4ERR_BADXDR );
233
223
@@ -245,14 +235,14 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
245
235
if (unlikely (status != 0 ))
246
236
return status ;
247
237
248
- p = read_buf (xdr , 2 * sizeof (uint64_t ));
238
+ p = xdr_inline_decode (xdr , 2 * sizeof (uint64_t ));
249
239
if (unlikely (p == NULL ))
250
240
return htonl (NFS4ERR_BADXDR );
251
241
p = xdr_decode_hyper (p , & args -> cbl_range .offset );
252
242
p = xdr_decode_hyper (p , & args -> cbl_range .length );
253
243
return decode_layout_stateid (xdr , & args -> cbl_stateid );
254
244
} 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 ));
256
246
if (unlikely (p == NULL ))
257
247
return htonl (NFS4ERR_BADXDR );
258
248
p = xdr_decode_hyper (p , & args -> cbl_fsid .major );
@@ -275,7 +265,7 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
275
265
args -> ndevs = 0 ;
276
266
277
267
/* Num of device notifications */
278
- p = read_buf (xdr , sizeof (uint32_t ));
268
+ p = xdr_inline_decode (xdr , sizeof (uint32_t ));
279
269
if (unlikely (p == NULL )) {
280
270
status = htonl (NFS4ERR_BADXDR );
281
271
goto out ;
@@ -298,7 +288,8 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
298
288
for (i = 0 ; i < n ; i ++ ) {
299
289
struct cb_devicenotifyitem * dev = & args -> devs [i ];
300
290
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 );
302
293
if (unlikely (p == NULL )) {
303
294
status = htonl (NFS4ERR_BADXDR );
304
295
goto err ;
@@ -329,7 +320,7 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
329
320
p += XDR_QUADLEN (NFS4_DEVICEID4_SIZE );
330
321
331
322
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 ));
333
324
if (unlikely (p == NULL )) {
334
325
status = htonl (NFS4ERR_BADXDR );
335
326
goto err ;
@@ -359,7 +350,7 @@ static __be32 decode_sessionid(struct xdr_stream *xdr,
359
350
{
360
351
__be32 * p ;
361
352
362
- p = read_buf (xdr , NFS4_MAX_SESSIONID_LEN );
353
+ p = xdr_inline_decode (xdr , NFS4_MAX_SESSIONID_LEN );
363
354
if (unlikely (p == NULL ))
364
355
return htonl (NFS4ERR_RESOURCE );
365
356
@@ -379,13 +370,13 @@ static __be32 decode_rc_list(struct xdr_stream *xdr,
379
370
goto out ;
380
371
381
372
status = htonl (NFS4ERR_RESOURCE );
382
- p = read_buf (xdr , sizeof (uint32_t ));
373
+ p = xdr_inline_decode (xdr , sizeof (uint32_t ));
383
374
if (unlikely (p == NULL ))
384
375
goto out ;
385
376
386
377
rc_list -> rcl_nrefcalls = ntohl (* p ++ );
387
378
if (rc_list -> rcl_nrefcalls ) {
388
- p = read_buf (xdr ,
379
+ p = xdr_inline_decode (xdr ,
389
380
rc_list -> rcl_nrefcalls * 2 * sizeof (uint32_t ));
390
381
if (unlikely (p == NULL ))
391
382
goto out ;
@@ -418,7 +409,7 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
418
409
if (status )
419
410
return status ;
420
411
421
- p = read_buf (xdr , 5 * sizeof (uint32_t ));
412
+ p = xdr_inline_decode (xdr , 5 * sizeof (uint32_t ));
422
413
if (unlikely (p == NULL ))
423
414
return htonl (NFS4ERR_RESOURCE );
424
415
@@ -461,7 +452,7 @@ static __be32 decode_recallany_args(struct svc_rqst *rqstp,
461
452
uint32_t bitmap [2 ];
462
453
__be32 * p , status ;
463
454
464
- p = read_buf (xdr , 4 );
455
+ p = xdr_inline_decode (xdr , 4 );
465
456
if (unlikely (p == NULL ))
466
457
return htonl (NFS4ERR_BADXDR );
467
458
args -> craa_objs_to_keep = ntohl (* p ++ );
@@ -480,7 +471,7 @@ static __be32 decode_recallslot_args(struct svc_rqst *rqstp,
480
471
struct cb_recallslotargs * args = argp ;
481
472
__be32 * p ;
482
473
483
- p = read_buf (xdr , 4 );
474
+ p = xdr_inline_decode (xdr , 4 );
484
475
if (unlikely (p == NULL ))
485
476
return htonl (NFS4ERR_BADXDR );
486
477
args -> crsa_target_highest_slotid = ntohl (* p ++ );
@@ -492,14 +483,14 @@ static __be32 decode_lockowner(struct xdr_stream *xdr, struct cb_notify_lock_arg
492
483
__be32 * p ;
493
484
unsigned int len ;
494
485
495
- p = read_buf (xdr , 12 );
486
+ p = xdr_inline_decode (xdr , 12 );
496
487
if (unlikely (p == NULL ))
497
488
return htonl (NFS4ERR_BADXDR );
498
489
499
490
p = xdr_decode_hyper (p , & args -> cbnl_owner .clientid );
500
491
len = be32_to_cpu (* p );
501
492
502
- p = read_buf (xdr , len );
493
+ p = xdr_inline_decode (xdr , len );
503
494
if (unlikely (p == NULL ))
504
495
return htonl (NFS4ERR_BADXDR );
505
496
@@ -537,7 +528,7 @@ static __be32 decode_write_response(struct xdr_stream *xdr,
537
528
__be32 * p ;
538
529
539
530
/* skip the always zero field */
540
- p = read_buf (xdr , 4 );
531
+ p = xdr_inline_decode (xdr , 4 );
541
532
if (unlikely (!p ))
542
533
goto out ;
543
534
p ++ ;
@@ -577,7 +568,7 @@ static __be32 decode_offload_args(struct svc_rqst *rqstp,
577
568
return status ;
578
569
579
570
/* decode status */
580
- p = read_buf (xdr , 4 );
571
+ p = xdr_inline_decode (xdr , 4 );
581
572
if (unlikely (!p ))
582
573
goto out ;
583
574
args -> error = ntohl (* p ++ );
0 commit comments