Commit 15eea9a1a8166b4bbab6c02cc426a7cc806ea2ca

Authored by Heinrich Schuchardt
Committed by Joe Hershberger
1 parent cccc05ee3b

net: nfs: remove superfluous conversions

rpc_pkt.u.call.data is an array of uint32_t. There is no need to convert
it to uint32_t *.

memcpy() expects void * as it 1st and 2nd argument. There is no point in
converting pointers to char * before passing them to memcpy().

In ntohl(data[1]) != 0 calling ntohl() is superfluous. If the value is
zero, does not depend on the byte order.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

... ... @@ -196,10 +196,10 @@
196 196 rpc_pkt.u.call.vers = htonl(2); /* portmapper is version 2 */
197 197 }
198 198 rpc_pkt.u.call.proc = htonl(rpc_proc);
199   - p = (uint32_t *)&(rpc_pkt.u.call.data);
  199 + p = rpc_pkt.u.call.data;
200 200  
201 201 if (datalen)
202   - memcpy((char *)p, (char *)data, datalen*sizeof(uint32_t));
  202 + memcpy(p, data, datalen * sizeof(uint32_t));
203 203  
204 204 pktlen = (char *)p + datalen * sizeof(uint32_t) - (char *)&rpc_pkt;
205 205  
... ... @@ -583,7 +583,7 @@
583 583  
584 584 static int nfs3_get_attributes_offset(uint32_t *data)
585 585 {
586   - if (ntohl(data[1]) != 0) {
  586 + if (data[1]) {
587 587 /* 'attributes_follow' flag is TRUE,
588 588 * so we have attributes on 21 dwords */
589 589 /* Skip unused values :