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: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
Chuck Lever
2024-09-10 15:31:19 -04:00
parent 4b132aacb0
commit 663ad8b1df
4 changed files with 5 additions and 5 deletions
@@ -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;