Commit 663ad8b1 authored by Chuck Lever's avatar Chuck Lever

xdrgen: Fix return code checking in built-in XDR decoders

xdr_stream_encode_u32() returns XDR_UNIT on success.
xdr_stream_decode_u32() returns zero or -EMSGSIZE, but never
XDR_UNIT.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 4b132aac
......@@ -184,7 +184,7 @@ xdrgen_decode_string(struct xdr_stream *xdr, string *ptr, u32 maxlen)
__be32 *p;
u32 len;
if (unlikely(xdr_stream_decode_u32(xdr, &len) != XDR_UNIT))
if (unlikely(xdr_stream_decode_u32(xdr, &len) < 0))
return false;
if (unlikely(maxlen && len > maxlen))
return false;
......@@ -215,7 +215,7 @@ xdrgen_decode_opaque(struct xdr_stream *xdr, opaque *ptr, u32 maxlen)
__be32 *p;
u32 len;
if (unlikely(xdr_stream_decode_u32(xdr, &len) != XDR_UNIT))
if (unlikely(xdr_stream_decode_u32(xdr, &len) < 0))
return false;
if (unlikely(maxlen && len > maxlen))
return false;
......
......@@ -2,7 +2,7 @@
{% if annotate %}
/* member {{ name }} (variable-length array) */
{% endif %}
if (xdr_stream_decode_u32(xdr, &ptr->{{ name }}.count) != XDR_UNIT)
if (xdr_stream_decode_u32(xdr, &ptr->{{ name }}.count) < 0)
return false;
{% if maxsize != "0" %}
if (ptr->{{ name }}.count > {{ maxsize }})
......
......@@ -2,7 +2,7 @@
{% if annotate %}
/* member {{ name }} (variable-length array) */
{% endif %}
if (xdr_stream_decode_u32(xdr, &ptr->{{ name }}.count) != XDR_UNIT)
if (xdr_stream_decode_u32(xdr, &ptr->{{ name }}.count) < 0)
return false;
{% if maxsize != "0" %}
if (ptr->{{ name }}.count > {{ maxsize }})
......
......@@ -2,7 +2,7 @@
{% if annotate %}
/* member {{ name }} (variable-length array) */
{% endif %}
if (xdr_stream_decode_u32(xdr, &count) != XDR_UNIT)
if (xdr_stream_decode_u32(xdr, &count) < 0)
return false;
if (count > {{ maxsize }})
return false;
......
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