aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Taine <benoit.taine@lip6.fr>2014-05-22 10:32:30 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-05-22 15:52:23 -0400
commitd40aa3372f90d478b6166df0321349b5aeb0aea8 (patch)
tree850ddb4df00cc40eb34f0b2ff2dbfe77d62f774e
parentf35ea0d4b66b789e0edcea634238e9aa31924516 (diff)
nfsd: Remove assignments inside conditions
Assignments should not happen inside an if conditional, but in the line before. This issue was reported by checkpatch. The semantic patch that makes this change is as follows (http://coccinelle.lip6.fr/): // <smpl> @@ identifier i1; expression e1; statement S; @@ -if(!(i1 = e1)) S +i1 = e1; +if(!i1) +S // </smpl> It has been tested by compilation. Signed-off-by: Benoit Taine <benoit.taine@lip6.fr> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfs2acl.c12
-rw-r--r--fs/nfsd/nfs3acl.c6
-rw-r--r--fs/nfsd/nfs3xdr.c27
-rw-r--r--fs/nfsd/nfsxdr.c15
4 files changed, 40 insertions, 20 deletions
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
index 11c1fba29312..12b023a7ab7d 100644
--- a/fs/nfsd/nfs2acl.c
+++ b/fs/nfsd/nfs2acl.c
@@ -182,7 +182,8 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessarg
182static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, 182static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
183 struct nfsd3_getaclargs *argp) 183 struct nfsd3_getaclargs *argp)
184{ 184{
185 if (!(p = nfs2svc_decode_fh(p, &argp->fh))) 185 p = nfs2svc_decode_fh(p, &argp->fh);
186 if (!p)
186 return 0; 187 return 0;
187 argp->mask = ntohl(*p); p++; 188 argp->mask = ntohl(*p); p++;
188 189
@@ -197,7 +198,8 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
197 unsigned int base; 198 unsigned int base;
198 int n; 199 int n;
199 200
200 if (!(p = nfs2svc_decode_fh(p, &argp->fh))) 201 p = nfs2svc_decode_fh(p, &argp->fh);
202 if (!p)
201 return 0; 203 return 0;
202 argp->mask = ntohl(*p++); 204 argp->mask = ntohl(*p++);
203 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) || 205 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) ||
@@ -218,7 +220,8 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
218static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p, 220static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p,
219 struct nfsd_fhandle *argp) 221 struct nfsd_fhandle *argp)
220{ 222{
221 if (!(p = nfs2svc_decode_fh(p, &argp->fh))) 223 p = nfs2svc_decode_fh(p, &argp->fh);
224 if (!p)
222 return 0; 225 return 0;
223 return xdr_argsize_check(rqstp, p); 226 return xdr_argsize_check(rqstp, p);
224} 227}
@@ -226,7 +229,8 @@ static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p,
226static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, 229static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
227 struct nfsd3_accessargs *argp) 230 struct nfsd3_accessargs *argp)
228{ 231{
229 if (!(p = nfs2svc_decode_fh(p, &argp->fh))) 232 p = nfs2svc_decode_fh(p, &argp->fh);
233 if (!p)
230 return 0; 234 return 0;
231 argp->access = ntohl(*p++); 235 argp->access = ntohl(*p++);
232 236
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
index adc5f1b1dc26..2a514e21dc74 100644
--- a/fs/nfsd/nfs3acl.c
+++ b/fs/nfsd/nfs3acl.c
@@ -128,7 +128,8 @@ out:
128static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, 128static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
129 struct nfsd3_getaclargs *args) 129 struct nfsd3_getaclargs *args)
130{ 130{
131 if (!(p = nfs3svc_decode_fh(p, &args->fh))) 131 p = nfs3svc_decode_fh(p, &args->fh);
132 if (!p)
132 return 0; 133 return 0;
133 args->mask = ntohl(*p); p++; 134 args->mask = ntohl(*p); p++;
134 135
@@ -143,7 +144,8 @@ static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
143 unsigned int base; 144 unsigned int base;
144 int n; 145 int n;
145 146
146 if (!(p = nfs3svc_decode_fh(p, &args->fh))) 147 p = nfs3svc_decode_fh(p, &args->fh);
148 if (!p)
147 return 0; 149 return 0;
148 args->mask = ntohl(*p++); 150 args->mask = ntohl(*p++);
149 if (args->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) || 151 if (args->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) ||
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index de6e39e12cb3..e6c01e80325e 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -278,7 +278,8 @@ void fill_post_wcc(struct svc_fh *fhp)
278int 278int
279nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args) 279nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args)
280{ 280{
281 if (!(p = decode_fh(p, &args->fh))) 281 p = decode_fh(p, &args->fh);
282 if (!p)
282 return 0; 283 return 0;
283 return xdr_argsize_check(rqstp, p); 284 return xdr_argsize_check(rqstp, p);
284} 285}
@@ -287,7 +288,8 @@ int
287nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p, 288nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p,
288 struct nfsd3_sattrargs *args) 289 struct nfsd3_sattrargs *args)
289{ 290{
290 if (!(p = decode_fh(p, &args->fh))) 291 p = decode_fh(p, &args->fh);
292 if (!p)
291 return 0; 293 return 0;
292 p = decode_sattr3(p, &args->attrs); 294 p = decode_sattr3(p, &args->attrs);
293 295
@@ -315,7 +317,8 @@ int
315nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, 317nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
316 struct nfsd3_accessargs *args) 318 struct nfsd3_accessargs *args)
317{ 319{
318 if (!(p = decode_fh(p, &args->fh))) 320 p = decode_fh(p, &args->fh);
321 if (!p)
319 return 0; 322 return 0;
320 args->access = ntohl(*p++); 323 args->access = ntohl(*p++);
321 324
@@ -330,7 +333,8 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
330 int v; 333 int v;
331 u32 max_blocksize = svc_max_payload(rqstp); 334 u32 max_blocksize = svc_max_payload(rqstp);
332 335
333 if (!(p = decode_fh(p, &args->fh))) 336 p = decode_fh(p, &args->fh);
337 if (!p)
334 return 0; 338 return 0;
335 p = xdr_decode_hyper(p, &args->offset); 339 p = xdr_decode_hyper(p, &args->offset);
336 340
@@ -360,7 +364,8 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
360 unsigned int len, v, hdr, dlen; 364 unsigned int len, v, hdr, dlen;
361 u32 max_blocksize = svc_max_payload(rqstp); 365 u32 max_blocksize = svc_max_payload(rqstp);
362 366
363 if (!(p = decode_fh(p, &args->fh))) 367 p = decode_fh(p, &args->fh);
368 if (!p)
364 return 0; 369 return 0;
365 p = xdr_decode_hyper(p, &args->offset); 370 p = xdr_decode_hyper(p, &args->offset);
366 371
@@ -535,7 +540,8 @@ int
535nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, 540nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p,
536 struct nfsd3_readlinkargs *args) 541 struct nfsd3_readlinkargs *args)
537{ 542{
538 if (!(p = decode_fh(p, &args->fh))) 543 p = decode_fh(p, &args->fh);
544 if (!p)
539 return 0; 545 return 0;
540 args->buffer = page_address(*(rqstp->rq_next_page++)); 546 args->buffer = page_address(*(rqstp->rq_next_page++));
541 547
@@ -558,7 +564,8 @@ int
558nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, 564nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
559 struct nfsd3_readdirargs *args) 565 struct nfsd3_readdirargs *args)
560{ 566{
561 if (!(p = decode_fh(p, &args->fh))) 567 p = decode_fh(p, &args->fh);
568 if (!p)
562 return 0; 569 return 0;
563 p = xdr_decode_hyper(p, &args->cookie); 570 p = xdr_decode_hyper(p, &args->cookie);
564 args->verf = p; p += 2; 571 args->verf = p; p += 2;
@@ -580,7 +587,8 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p,
580 int len; 587 int len;
581 u32 max_blocksize = svc_max_payload(rqstp); 588 u32 max_blocksize = svc_max_payload(rqstp);
582 589
583 if (!(p = decode_fh(p, &args->fh))) 590 p = decode_fh(p, &args->fh);
591 if (!p)
584 return 0; 592 return 0;
585 p = xdr_decode_hyper(p, &args->cookie); 593 p = xdr_decode_hyper(p, &args->cookie);
586 args->verf = p; p += 2; 594 args->verf = p; p += 2;
@@ -605,7 +613,8 @@ int
605nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p, 613nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p,
606 struct nfsd3_commitargs *args) 614 struct nfsd3_commitargs *args)
607{ 615{
608 if (!(p = decode_fh(p, &args->fh))) 616 p = decode_fh(p, &args->fh);
617 if (!p)
609 return 0; 618 return 0;
610 p = xdr_decode_hyper(p, &args->offset); 619 p = xdr_decode_hyper(p, &args->offset);
611 args->count = ntohl(*p++); 620 args->count = ntohl(*p++);
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 9c769a47ac5a..1ac306b769df 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -214,7 +214,8 @@ nfssvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
214int 214int
215nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args) 215nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args)
216{ 216{
217 if (!(p = decode_fh(p, &args->fh))) 217 p = decode_fh(p, &args->fh);
218 if (!p)
218 return 0; 219 return 0;
219 return xdr_argsize_check(rqstp, p); 220 return xdr_argsize_check(rqstp, p);
220} 221}
@@ -248,7 +249,8 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
248{ 249{
249 unsigned int len; 250 unsigned int len;
250 int v; 251 int v;
251 if (!(p = decode_fh(p, &args->fh))) 252 p = decode_fh(p, &args->fh);
253 if (!p)
252 return 0; 254 return 0;
253 255
254 args->offset = ntohl(*p++); 256 args->offset = ntohl(*p++);
@@ -281,7 +283,8 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
281 unsigned int len, hdr, dlen; 283 unsigned int len, hdr, dlen;
282 int v; 284 int v;
283 285
284 if (!(p = decode_fh(p, &args->fh))) 286 p = decode_fh(p, &args->fh);
287 if (!p)
285 return 0; 288 return 0;
286 289
287 p++; /* beginoffset */ 290 p++; /* beginoffset */
@@ -355,7 +358,8 @@ nfssvc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p,
355int 358int
356nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readlinkargs *args) 359nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readlinkargs *args)
357{ 360{
358 if (!(p = decode_fh(p, &args->fh))) 361 p = decode_fh(p, &args->fh);
362 if (!p)
359 return 0; 363 return 0;
360 args->buffer = page_address(*(rqstp->rq_next_page++)); 364 args->buffer = page_address(*(rqstp->rq_next_page++));
361 365
@@ -391,7 +395,8 @@ int
391nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, 395nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
392 struct nfsd_readdirargs *args) 396 struct nfsd_readdirargs *args)
393{ 397{
394 if (!(p = decode_fh(p, &args->fh))) 398 p = decode_fh(p, &args->fh);
399 if (!p)
395 return 0; 400 return 0;
396 args->cookie = ntohl(*p++); 401 args->cookie = ntohl(*p++);
397 args->count = ntohl(*p++); 402 args->count = ntohl(*p++);