diff options
author | Jakub Kicinski <kuba@kernel.org> | 2023-06-02 04:35:43 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-06-03 07:10:47 +0200 |
commit | eef9b794eac87022464c28a3763f9030e1d53f80 (patch) | |
tree | 062dd2939b9301757f94b0fcad68cb75e437a449 /tools/net | |
parent | tools: ynl-gen: loosen type consistency check for events (diff) | |
download | linux-eef9b794eac87022464c28a3763f9030e1d53f80.tar.xz linux-eef9b794eac87022464c28a3763f9030e1d53f80.zip |
tools: ynl-gen: add error checking for nested structs
Parsing nested types may return an error, propagate it.
Not marking as a fix, because nothing uses YNL upstream.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/net')
-rwxr-xr-x | tools/net/ynl/ynl-gen-c.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py index 2ceb4ce1423f..8bf4b70216d7 100755 --- a/tools/net/ynl/ynl-gen-c.py +++ b/tools/net/ynl/ynl-gen-c.py @@ -424,7 +424,8 @@ class TypeNest(Type): f"{self.enum_name}, &{var}->{self.c_name})") def _attr_get(self, ri, var): - get_lines = [f"{self.nested_render_name}_parse(&parg, attr);"] + get_lines = [f"if ({self.nested_render_name}_parse(&parg, attr))", + "return MNL_CB_ERROR;"] init_lines = [f"parg.rsp_policy = &{self.nested_render_name}_nest;", f"parg.data = &{var}->{self.c_name};"] return get_lines, init_lines, None |