diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs2xdr.c | 4 | ||||
-rw-r--r-- | fs/nfs/nfs3xdr.c | 7 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 6 |
3 files changed, 6 insertions, 11 deletions
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index d04f0df7be55..06b9df49f7f7 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c | |||
@@ -195,7 +195,6 @@ static void encode_fhandle(struct xdr_stream *xdr, const struct nfs_fh *fh) | |||
195 | { | 195 | { |
196 | __be32 *p; | 196 | __be32 *p; |
197 | 197 | ||
198 | BUG_ON(fh->size != NFS2_FHSIZE); | ||
199 | p = xdr_reserve_space(xdr, NFS2_FHSIZE); | 198 | p = xdr_reserve_space(xdr, NFS2_FHSIZE); |
200 | memcpy(p, fh->data, NFS2_FHSIZE); | 199 | memcpy(p, fh->data, NFS2_FHSIZE); |
201 | } | 200 | } |
@@ -388,7 +387,7 @@ static void encode_filename(struct xdr_stream *xdr, | |||
388 | { | 387 | { |
389 | __be32 *p; | 388 | __be32 *p; |
390 | 389 | ||
391 | BUG_ON(length > NFS2_MAXNAMLEN); | 390 | WARN_ON_ONCE(length > NFS2_MAXNAMLEN); |
392 | p = xdr_reserve_space(xdr, 4 + length); | 391 | p = xdr_reserve_space(xdr, 4 + length); |
393 | xdr_encode_opaque(p, name, length); | 392 | xdr_encode_opaque(p, name, length); |
394 | } | 393 | } |
@@ -428,7 +427,6 @@ static void encode_path(struct xdr_stream *xdr, struct page **pages, u32 length) | |||
428 | { | 427 | { |
429 | __be32 *p; | 428 | __be32 *p; |
430 | 429 | ||
431 | BUG_ON(length > NFS2_MAXPATHLEN); | ||
432 | p = xdr_reserve_space(xdr, 4); | 430 | p = xdr_reserve_space(xdr, 4); |
433 | *p = cpu_to_be32(length); | 431 | *p = cpu_to_be32(length); |
434 | xdr_write_pages(xdr, pages, 0, length); | 432 | xdr_write_pages(xdr, pages, 0, length); |
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 6cbe89400dfc..bffc32406fbf 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -198,7 +198,7 @@ static void encode_filename3(struct xdr_stream *xdr, | |||
198 | { | 198 | { |
199 | __be32 *p; | 199 | __be32 *p; |
200 | 200 | ||
201 | BUG_ON(length > NFS3_MAXNAMLEN); | 201 | WARN_ON_ONCE(length > NFS3_MAXNAMLEN); |
202 | p = xdr_reserve_space(xdr, 4 + length); | 202 | p = xdr_reserve_space(xdr, 4 + length); |
203 | xdr_encode_opaque(p, name, length); | 203 | xdr_encode_opaque(p, name, length); |
204 | } | 204 | } |
@@ -238,7 +238,6 @@ out_overflow: | |||
238 | static void encode_nfspath3(struct xdr_stream *xdr, struct page **pages, | 238 | static void encode_nfspath3(struct xdr_stream *xdr, struct page **pages, |
239 | const u32 length) | 239 | const u32 length) |
240 | { | 240 | { |
241 | BUG_ON(length > NFS3_MAXPATHLEN); | ||
242 | encode_uint32(xdr, length); | 241 | encode_uint32(xdr, length); |
243 | xdr_write_pages(xdr, pages, 0, length); | 242 | xdr_write_pages(xdr, pages, 0, length); |
244 | } | 243 | } |
@@ -388,7 +387,6 @@ out_overflow: | |||
388 | */ | 387 | */ |
389 | static void encode_ftype3(struct xdr_stream *xdr, const u32 type) | 388 | static void encode_ftype3(struct xdr_stream *xdr, const u32 type) |
390 | { | 389 | { |
391 | BUG_ON(type > NF3FIFO); | ||
392 | encode_uint32(xdr, type); | 390 | encode_uint32(xdr, type); |
393 | } | 391 | } |
394 | 392 | ||
@@ -443,7 +441,7 @@ static void encode_nfs_fh3(struct xdr_stream *xdr, const struct nfs_fh *fh) | |||
443 | { | 441 | { |
444 | __be32 *p; | 442 | __be32 *p; |
445 | 443 | ||
446 | BUG_ON(fh->size > NFS3_FHSIZE); | 444 | WARN_ON_ONCE(fh->size > NFS3_FHSIZE); |
447 | p = xdr_reserve_space(xdr, 4 + fh->size); | 445 | p = xdr_reserve_space(xdr, 4 + fh->size); |
448 | xdr_encode_opaque(p, fh->data, fh->size); | 446 | xdr_encode_opaque(p, fh->data, fh->size); |
449 | } | 447 | } |
@@ -1339,6 +1337,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req, | |||
1339 | error = nfsacl_encode(xdr->buf, base, args->inode, | 1337 | error = nfsacl_encode(xdr->buf, base, args->inode, |
1340 | (args->mask & NFS_ACL) ? | 1338 | (args->mask & NFS_ACL) ? |
1341 | args->acl_access : NULL, 1, 0); | 1339 | args->acl_access : NULL, 1, 0); |
1340 | /* FIXME: this is just broken */ | ||
1342 | BUG_ON(error < 0); | 1341 | BUG_ON(error < 0); |
1343 | error = nfsacl_encode(xdr->buf, base + error, args->inode, | 1342 | error = nfsacl_encode(xdr->buf, base + error, args->inode, |
1344 | (args->mask & NFS_DFACL) ? | 1343 | (args->mask & NFS_DFACL) ? |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 40836ee5dc3a..672d9b0ef2c5 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -936,7 +936,7 @@ static void encode_compound_hdr(struct xdr_stream *xdr, | |||
936 | * but this is not required as a MUST for the server to do so. */ | 936 | * but this is not required as a MUST for the server to do so. */ |
937 | hdr->replen = RPC_REPHDRSIZE + auth->au_rslack + 3 + hdr->taglen; | 937 | hdr->replen = RPC_REPHDRSIZE + auth->au_rslack + 3 + hdr->taglen; |
938 | 938 | ||
939 | BUG_ON(hdr->taglen > NFS4_MAXTAGLEN); | 939 | WARN_ON_ONCE(hdr->taglen > NFS4_MAXTAGLEN); |
940 | encode_string(xdr, hdr->taglen, hdr->tag); | 940 | encode_string(xdr, hdr->taglen, hdr->tag); |
941 | p = reserve_space(xdr, 8); | 941 | p = reserve_space(xdr, 8); |
942 | *p++ = cpu_to_be32(hdr->minorversion); | 942 | *p++ = cpu_to_be32(hdr->minorversion); |
@@ -955,7 +955,7 @@ static void encode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 op, | |||
955 | 955 | ||
956 | static void encode_nops(struct compound_hdr *hdr) | 956 | static void encode_nops(struct compound_hdr *hdr) |
957 | { | 957 | { |
958 | BUG_ON(hdr->nops > NFS4_MAX_OPS); | 958 | WARN_ON_ONCE(hdr->nops > NFS4_MAX_OPS); |
959 | *hdr->nops_p = htonl(hdr->nops); | 959 | *hdr->nops_p = htonl(hdr->nops); |
960 | } | 960 | } |
961 | 961 | ||
@@ -1403,7 +1403,6 @@ static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *a | |||
1403 | *p = cpu_to_be32(NFS4_OPEN_NOCREATE); | 1403 | *p = cpu_to_be32(NFS4_OPEN_NOCREATE); |
1404 | break; | 1404 | break; |
1405 | default: | 1405 | default: |
1406 | BUG_ON(arg->claim != NFS4_OPEN_CLAIM_NULL); | ||
1407 | *p = cpu_to_be32(NFS4_OPEN_CREATE); | 1406 | *p = cpu_to_be32(NFS4_OPEN_CREATE); |
1408 | encode_createmode(xdr, arg); | 1407 | encode_createmode(xdr, arg); |
1409 | } | 1408 | } |
@@ -1621,7 +1620,6 @@ encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg, struct compoun | |||
1621 | p = reserve_space(xdr, 2*4); | 1620 | p = reserve_space(xdr, 2*4); |
1622 | *p++ = cpu_to_be32(1); | 1621 | *p++ = cpu_to_be32(1); |
1623 | *p = cpu_to_be32(FATTR4_WORD0_ACL); | 1622 | *p = cpu_to_be32(FATTR4_WORD0_ACL); |
1624 | BUG_ON(arg->acl_len % 4); | ||
1625 | p = reserve_space(xdr, 4); | 1623 | p = reserve_space(xdr, 4); |
1626 | *p = cpu_to_be32(arg->acl_len); | 1624 | *p = cpu_to_be32(arg->acl_len); |
1627 | xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len); | 1625 | xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len); |