diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-15 17:14:38 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-11-04 14:43:39 -0500 |
commit | aad56de378b4c675e964a1ab44cf2e55d44d2865 (patch) | |
tree | f08d736bac1a97e67bee57768d51cf8c1e6098cc /fs/lockd | |
parent | 28d79ea33f52cae1ea04808e1ec52b8657b5d804 (diff) |
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: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/lockd')
-rw-r--r-- | fs/lockd/clnt4xdr.c | 8 | ||||
-rw-r--r-- | fs/lockd/clntxdr.c | 8 |
2 files changed, 0 insertions, 16 deletions
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c index 13ad1539fbf2..00ec0b9c94d1 100644 --- a/fs/lockd/clnt4xdr.c +++ b/fs/lockd/clnt4xdr.c | |||
@@ -64,10 +64,6 @@ static void nlm4_compute_offsets(const struct nlm_lock *lock, | |||
64 | { | 64 | { |
65 | const struct file_lock *fl = &lock->fl; | 65 | const struct file_lock *fl = &lock->fl; |
66 | 66 | ||
67 | BUG_ON(fl->fl_start > NLM4_OFFSET_MAX); | ||
68 | BUG_ON(fl->fl_end > NLM4_OFFSET_MAX && | ||
69 | fl->fl_end != OFFSET_MAX); | ||
70 | |||
71 | *l_offset = loff_t_to_s64(fl->fl_start); | 67 | *l_offset = loff_t_to_s64(fl->fl_start); |
72 | if (fl->fl_end == OFFSET_MAX) | 68 | if (fl->fl_end == OFFSET_MAX) |
73 | *l_len = 0; | 69 | *l_len = 0; |
@@ -122,7 +118,6 @@ static void encode_netobj(struct xdr_stream *xdr, | |||
122 | { | 118 | { |
123 | __be32 *p; | 119 | __be32 *p; |
124 | 120 | ||
125 | BUG_ON(length > XDR_MAX_NETOBJ); | ||
126 | p = xdr_reserve_space(xdr, 4 + length); | 121 | p = xdr_reserve_space(xdr, 4 + length); |
127 | xdr_encode_opaque(p, data, length); | 122 | xdr_encode_opaque(p, data, length); |
128 | } | 123 | } |
@@ -156,7 +151,6 @@ out_overflow: | |||
156 | static void encode_cookie(struct xdr_stream *xdr, | 151 | static void encode_cookie(struct xdr_stream *xdr, |
157 | const struct nlm_cookie *cookie) | 152 | const struct nlm_cookie *cookie) |
158 | { | 153 | { |
159 | BUG_ON(cookie->len > NLM_MAXCOOKIELEN); | ||
160 | encode_netobj(xdr, (u8 *)&cookie->data, cookie->len); | 154 | encode_netobj(xdr, (u8 *)&cookie->data, cookie->len); |
161 | } | 155 | } |
162 | 156 | ||
@@ -198,7 +192,6 @@ out_overflow: | |||
198 | */ | 192 | */ |
199 | static void encode_fh(struct xdr_stream *xdr, const struct nfs_fh *fh) | 193 | static void encode_fh(struct xdr_stream *xdr, const struct nfs_fh *fh) |
200 | { | 194 | { |
201 | BUG_ON(fh->size > NFS3_FHSIZE); | ||
202 | encode_netobj(xdr, (u8 *)&fh->data, fh->size); | 195 | encode_netobj(xdr, (u8 *)&fh->data, fh->size); |
203 | } | 196 | } |
204 | 197 | ||
@@ -336,7 +329,6 @@ static void encode_caller_name(struct xdr_stream *xdr, const char *name) | |||
336 | u32 length = strlen(name); | 329 | u32 length = strlen(name); |
337 | __be32 *p; | 330 | __be32 *p; |
338 | 331 | ||
339 | BUG_ON(length > NLM_MAXSTRLEN); | ||
340 | p = xdr_reserve_space(xdr, 4 + length); | 332 | p = xdr_reserve_space(xdr, 4 + length); |
341 | xdr_encode_opaque(p, name, length); | 333 | xdr_encode_opaque(p, name, length); |
342 | } | 334 | } |
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c index 982d2676e1f8..9a55797a1cd4 100644 --- a/fs/lockd/clntxdr.c +++ b/fs/lockd/clntxdr.c | |||
@@ -60,10 +60,6 @@ static void nlm_compute_offsets(const struct nlm_lock *lock, | |||
60 | { | 60 | { |
61 | const struct file_lock *fl = &lock->fl; | 61 | const struct file_lock *fl = &lock->fl; |
62 | 62 | ||
63 | BUG_ON(fl->fl_start > NLM_OFFSET_MAX); | ||
64 | BUG_ON(fl->fl_end > NLM_OFFSET_MAX && | ||
65 | fl->fl_end != OFFSET_MAX); | ||
66 | |||
67 | *l_offset = loff_t_to_s32(fl->fl_start); | 63 | *l_offset = loff_t_to_s32(fl->fl_start); |
68 | if (fl->fl_end == OFFSET_MAX) | 64 | if (fl->fl_end == OFFSET_MAX) |
69 | *l_len = 0; | 65 | *l_len = 0; |
@@ -119,7 +115,6 @@ static void encode_netobj(struct xdr_stream *xdr, | |||
119 | { | 115 | { |
120 | __be32 *p; | 116 | __be32 *p; |
121 | 117 | ||
122 | BUG_ON(length > XDR_MAX_NETOBJ); | ||
123 | p = xdr_reserve_space(xdr, 4 + length); | 118 | p = xdr_reserve_space(xdr, 4 + length); |
124 | xdr_encode_opaque(p, data, length); | 119 | xdr_encode_opaque(p, data, length); |
125 | } | 120 | } |
@@ -153,7 +148,6 @@ out_overflow: | |||
153 | static void encode_cookie(struct xdr_stream *xdr, | 148 | static void encode_cookie(struct xdr_stream *xdr, |
154 | const struct nlm_cookie *cookie) | 149 | const struct nlm_cookie *cookie) |
155 | { | 150 | { |
156 | BUG_ON(cookie->len > NLM_MAXCOOKIELEN); | ||
157 | encode_netobj(xdr, (u8 *)&cookie->data, cookie->len); | 151 | encode_netobj(xdr, (u8 *)&cookie->data, cookie->len); |
158 | } | 152 | } |
159 | 153 | ||
@@ -195,7 +189,6 @@ out_overflow: | |||
195 | */ | 189 | */ |
196 | static void encode_fh(struct xdr_stream *xdr, const struct nfs_fh *fh) | 190 | static void encode_fh(struct xdr_stream *xdr, const struct nfs_fh *fh) |
197 | { | 191 | { |
198 | BUG_ON(fh->size != NFS2_FHSIZE); | ||
199 | encode_netobj(xdr, (u8 *)&fh->data, NFS2_FHSIZE); | 192 | encode_netobj(xdr, (u8 *)&fh->data, NFS2_FHSIZE); |
200 | } | 193 | } |
201 | 194 | ||
@@ -330,7 +323,6 @@ static void encode_caller_name(struct xdr_stream *xdr, const char *name) | |||
330 | u32 length = strlen(name); | 323 | u32 length = strlen(name); |
331 | __be32 *p; | 324 | __be32 *p; |
332 | 325 | ||
333 | BUG_ON(length > NLM_MAXSTRLEN); | ||
334 | p = xdr_reserve_space(xdr, 4 + length); | 326 | p = xdr_reserve_space(xdr, 4 + length); |
335 | xdr_encode_opaque(p, name, length); | 327 | xdr_encode_opaque(p, name, length); |
336 | } | 328 | } |