Commit aad56de378b4c675e964a1ab44cf2e55d44d2865

Authored by Trond Myklebust
1 parent 28d79ea33f

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>

Showing 2 changed files with 0 additions and 16 deletions Side-by-side Diff

... ... @@ -64,10 +64,6 @@
64 64 {
65 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 67 *l_offset = loff_t_to_s64(fl->fl_start);
72 68 if (fl->fl_end == OFFSET_MAX)
73 69 *l_len = 0;
... ... @@ -122,7 +118,6 @@
122 118 {
123 119 __be32 *p;
124 120  
125   - BUG_ON(length > XDR_MAX_NETOBJ);
126 121 p = xdr_reserve_space(xdr, 4 + length);
127 122 xdr_encode_opaque(p, data, length);
128 123 }
... ... @@ -156,7 +151,6 @@
156 151 static void encode_cookie(struct xdr_stream *xdr,
157 152 const struct nlm_cookie *cookie)
158 153 {
159   - BUG_ON(cookie->len > NLM_MAXCOOKIELEN);
160 154 encode_netobj(xdr, (u8 *)&cookie->data, cookie->len);
161 155 }
162 156  
... ... @@ -198,7 +192,6 @@
198 192 */
199 193 static void encode_fh(struct xdr_stream *xdr, const struct nfs_fh *fh)
200 194 {
201   - BUG_ON(fh->size > NFS3_FHSIZE);
202 195 encode_netobj(xdr, (u8 *)&fh->data, fh->size);
203 196 }
204 197  
... ... @@ -336,7 +329,6 @@
336 329 u32 length = strlen(name);
337 330 __be32 *p;
338 331  
339   - BUG_ON(length > NLM_MAXSTRLEN);
340 332 p = xdr_reserve_space(xdr, 4 + length);
341 333 xdr_encode_opaque(p, name, length);
342 334 }
... ... @@ -60,10 +60,6 @@
60 60 {
61 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 63 *l_offset = loff_t_to_s32(fl->fl_start);
68 64 if (fl->fl_end == OFFSET_MAX)
69 65 *l_len = 0;
... ... @@ -119,7 +115,6 @@
119 115 {
120 116 __be32 *p;
121 117  
122   - BUG_ON(length > XDR_MAX_NETOBJ);
123 118 p = xdr_reserve_space(xdr, 4 + length);
124 119 xdr_encode_opaque(p, data, length);
125 120 }
... ... @@ -153,7 +148,6 @@
153 148 static void encode_cookie(struct xdr_stream *xdr,
154 149 const struct nlm_cookie *cookie)
155 150 {
156   - BUG_ON(cookie->len > NLM_MAXCOOKIELEN);
157 151 encode_netobj(xdr, (u8 *)&cookie->data, cookie->len);
158 152 }
159 153  
... ... @@ -195,7 +189,6 @@
195 189 */
196 190 static void encode_fh(struct xdr_stream *xdr, const struct nfs_fh *fh)
197 191 {
198   - BUG_ON(fh->size != NFS2_FHSIZE);
199 192 encode_netobj(xdr, (u8 *)&fh->data, NFS2_FHSIZE);
200 193 }
201 194  
... ... @@ -330,7 +323,6 @@
330 323 u32 length = strlen(name);
331 324 __be32 *p;
332 325  
333   - BUG_ON(length > NLM_MAXSTRLEN);
334 326 p = xdr_reserve_space(xdr, 4 + length);
335 327 xdr_encode_opaque(p, name, length);
336 328 }