summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2024-09-10 15:31:19 -0400
committerChuck Lever <chuck.lever@oracle.com>2024-09-20 19:31:39 -0400
commit663ad8b1df8724cd5e01df66ea67ce0424fbcdf6 (patch)
tree20cce90e2f2644cc235f6809ce3104daf3a78b3d /tools
parent4b132aacb0768ac1e652cf517097ea6f237214b9 (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/net/sunrpc/xdrgen/templates/C/pointer/decoder/variable_length_array.j22
-rw-r--r--tools/net/sunrpc/xdrgen/templates/C/struct/decoder/variable_length_array.j22
-rw-r--r--tools/net/sunrpc/xdrgen/templates/C/union/decoder/variable_length_array.j22
3 files changed, 3 insertions, 3 deletions
diff --git a/tools/net/sunrpc/xdrgen/templates/C/pointer/decoder/variable_length_array.j2 b/tools/net/sunrpc/xdrgen/templates/C/pointer/decoder/variable_length_array.j2
index f54ccd136762..2f943909cdf7 100644
--- a/tools/net/sunrpc/xdrgen/templates/C/pointer/decoder/variable_length_array.j2
+++ b/tools/net/sunrpc/xdrgen/templates/C/pointer/decoder/variable_length_array.j2
@@ -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 }})
diff --git a/tools/net/sunrpc/xdrgen/templates/C/struct/decoder/variable_length_array.j2 b/tools/net/sunrpc/xdrgen/templates/C/struct/decoder/variable_length_array.j2
index f54ccd136762..2f943909cdf7 100644
--- a/tools/net/sunrpc/xdrgen/templates/C/struct/decoder/variable_length_array.j2
+++ b/tools/net/sunrpc/xdrgen/templates/C/struct/decoder/variable_length_array.j2
@@ -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 }})
diff --git a/tools/net/sunrpc/xdrgen/templates/C/union/decoder/variable_length_array.j2 b/tools/net/sunrpc/xdrgen/templates/C/union/decoder/variable_length_array.j2
index eee2b9a68e27..51ad736d2530 100644
--- a/tools/net/sunrpc/xdrgen/templates/C/union/decoder/variable_length_array.j2
+++ b/tools/net/sunrpc/xdrgen/templates/C/union/decoder/variable_length_array.j2
@@ -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;