Commit aad56de3 authored by Trond Myklebust's avatar Trond Myklebust

lockd: Remove unnecessary BUG_ON()s in the xdr client code

- Offset bound checks are done in the NFS client code.
- So are filehandle size checks
- The cookie length is a constant
- The utsname()->nodename is already bounded
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 28d79ea3
...@@ -64,10 +64,6 @@ static void nlm4_compute_offsets(const struct nlm_lock *lock, ...@@ -64,10 +64,6 @@ static void nlm4_compute_offsets(const struct nlm_lock *lock,
{ {
const struct file_lock *fl = &lock->fl; const struct file_lock *fl = &lock->fl;
BUG_ON(fl->fl_start > NLM4_OFFSET_MAX);
BUG_ON(fl->fl_end > NLM4_OFFSET_MAX &&
fl->fl_end != OFFSET_MAX);
*l_offset = loff_t_to_s64(fl->fl_start); *l_offset = loff_t_to_s64(fl->fl_start);
if (fl->fl_end == OFFSET_MAX) if (fl->fl_end == OFFSET_MAX)
*l_len = 0; *l_len = 0;
...@@ -122,7 +118,6 @@ static void encode_netobj(struct xdr_stream *xdr, ...@@ -122,7 +118,6 @@ static void encode_netobj(struct xdr_stream *xdr,
{ {
__be32 *p; __be32 *p;
BUG_ON(length > XDR_MAX_NETOBJ);
p = xdr_reserve_space(xdr, 4 + length); p = xdr_reserve_space(xdr, 4 + length);
xdr_encode_opaque(p, data, length); xdr_encode_opaque(p, data, length);
} }
...@@ -156,7 +151,6 @@ static int decode_netobj(struct xdr_stream *xdr, ...@@ -156,7 +151,6 @@ static int decode_netobj(struct xdr_stream *xdr,
static void encode_cookie(struct xdr_stream *xdr, static void encode_cookie(struct xdr_stream *xdr,
const struct nlm_cookie *cookie) const struct nlm_cookie *cookie)
{ {
BUG_ON(cookie->len > NLM_MAXCOOKIELEN);
encode_netobj(xdr, (u8 *)&cookie->data, cookie->len); encode_netobj(xdr, (u8 *)&cookie->data, cookie->len);
} }
...@@ -198,7 +192,6 @@ static int decode_cookie(struct xdr_stream *xdr, ...@@ -198,7 +192,6 @@ static int decode_cookie(struct xdr_stream *xdr,
*/ */
static void encode_fh(struct xdr_stream *xdr, const struct nfs_fh *fh) static void encode_fh(struct xdr_stream *xdr, const struct nfs_fh *fh)
{ {
BUG_ON(fh->size > NFS3_FHSIZE);
encode_netobj(xdr, (u8 *)&fh->data, fh->size); encode_netobj(xdr, (u8 *)&fh->data, fh->size);
} }
...@@ -336,7 +329,6 @@ static void encode_caller_name(struct xdr_stream *xdr, const char *name) ...@@ -336,7 +329,6 @@ static void encode_caller_name(struct xdr_stream *xdr, const char *name)
u32 length = strlen(name); u32 length = strlen(name);
__be32 *p; __be32 *p;
BUG_ON(length > NLM_MAXSTRLEN);
p = xdr_reserve_space(xdr, 4 + length); p = xdr_reserve_space(xdr, 4 + length);
xdr_encode_opaque(p, name, length); xdr_encode_opaque(p, name, length);
} }
......
...@@ -60,10 +60,6 @@ static void nlm_compute_offsets(const struct nlm_lock *lock, ...@@ -60,10 +60,6 @@ static void nlm_compute_offsets(const struct nlm_lock *lock,
{ {
const struct file_lock *fl = &lock->fl; const struct file_lock *fl = &lock->fl;
BUG_ON(fl->fl_start > NLM_OFFSET_MAX);
BUG_ON(fl->fl_end > NLM_OFFSET_MAX &&
fl->fl_end != OFFSET_MAX);
*l_offset = loff_t_to_s32(fl->fl_start); *l_offset = loff_t_to_s32(fl->fl_start);
if (fl->fl_end == OFFSET_MAX) if (fl->fl_end == OFFSET_MAX)
*l_len = 0; *l_len = 0;
...@@ -119,7 +115,6 @@ static void encode_netobj(struct xdr_stream *xdr, ...@@ -119,7 +115,6 @@ static void encode_netobj(struct xdr_stream *xdr,
{ {
__be32 *p; __be32 *p;
BUG_ON(length > XDR_MAX_NETOBJ);
p = xdr_reserve_space(xdr, 4 + length); p = xdr_reserve_space(xdr, 4 + length);
xdr_encode_opaque(p, data, length); xdr_encode_opaque(p, data, length);
} }
...@@ -153,7 +148,6 @@ static int decode_netobj(struct xdr_stream *xdr, ...@@ -153,7 +148,6 @@ static int decode_netobj(struct xdr_stream *xdr,
static void encode_cookie(struct xdr_stream *xdr, static void encode_cookie(struct xdr_stream *xdr,
const struct nlm_cookie *cookie) const struct nlm_cookie *cookie)
{ {
BUG_ON(cookie->len > NLM_MAXCOOKIELEN);
encode_netobj(xdr, (u8 *)&cookie->data, cookie->len); encode_netobj(xdr, (u8 *)&cookie->data, cookie->len);
} }
...@@ -195,7 +189,6 @@ static int decode_cookie(struct xdr_stream *xdr, ...@@ -195,7 +189,6 @@ static int decode_cookie(struct xdr_stream *xdr,
*/ */
static void encode_fh(struct xdr_stream *xdr, const struct nfs_fh *fh) static void encode_fh(struct xdr_stream *xdr, const struct nfs_fh *fh)
{ {
BUG_ON(fh->size != NFS2_FHSIZE);
encode_netobj(xdr, (u8 *)&fh->data, NFS2_FHSIZE); encode_netobj(xdr, (u8 *)&fh->data, NFS2_FHSIZE);
} }
...@@ -330,7 +323,6 @@ static void encode_caller_name(struct xdr_stream *xdr, const char *name) ...@@ -330,7 +323,6 @@ static void encode_caller_name(struct xdr_stream *xdr, const char *name)
u32 length = strlen(name); u32 length = strlen(name);
__be32 *p; __be32 *p;
BUG_ON(length > NLM_MAXSTRLEN);
p = xdr_reserve_space(xdr, 4 + length); p = xdr_reserve_space(xdr, 4 + length);
xdr_encode_opaque(p, name, length); xdr_encode_opaque(p, name, length);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment