Commit dd51db18 authored by Kinglong Mee's avatar Kinglong Mee Committed by J. Bruce Fields

nfsd/blocklayout: Make sure calculate signature/designator length aligned

These values are all multiples of 4 already, so there's no change in
behavior from this patch.  But perhaps this will prevent mistakes in the
future.
Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 15d66ac2
...@@ -43,7 +43,7 @@ nfsd4_block_encode_volume(struct xdr_stream *xdr, struct pnfs_block_volume *b) ...@@ -43,7 +43,7 @@ nfsd4_block_encode_volume(struct xdr_stream *xdr, struct pnfs_block_volume *b)
switch (b->type) { switch (b->type) {
case PNFS_BLOCK_VOLUME_SIMPLE: case PNFS_BLOCK_VOLUME_SIMPLE:
len = 4 + 4 + 8 + 4 + b->simple.sig_len; len = 4 + 4 + 8 + 4 + (XDR_QUADLEN(b->simple.sig_len) << 2);
p = xdr_reserve_space(xdr, len); p = xdr_reserve_space(xdr, len);
if (!p) if (!p)
return -ETOOSMALL; return -ETOOSMALL;
...@@ -54,7 +54,7 @@ nfsd4_block_encode_volume(struct xdr_stream *xdr, struct pnfs_block_volume *b) ...@@ -54,7 +54,7 @@ nfsd4_block_encode_volume(struct xdr_stream *xdr, struct pnfs_block_volume *b)
p = xdr_encode_opaque(p, b->simple.sig, b->simple.sig_len); p = xdr_encode_opaque(p, b->simple.sig, b->simple.sig_len);
break; break;
case PNFS_BLOCK_VOLUME_SCSI: case PNFS_BLOCK_VOLUME_SCSI:
len = 4 + 4 + 4 + 4 + b->scsi.designator_len + 8; len = 4 + 4 + 4 + 4 + (XDR_QUADLEN(b->scsi.designator_len) << 2) + 8;
p = xdr_reserve_space(xdr, len); p = xdr_reserve_space(xdr, len);
if (!p) if (!p)
return -ETOOSMALL; return -ETOOSMALL;
......
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