| 1b255e1b | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl: add ipv4-or-v6 display hint
The attribute WGALLOWEDIP_A_IPADDR can contain either an IPv4 or an IPv6 address depending on WGALLOWEDIP_A_FAMILY, however in practice it is enough to look a
tools: ynl: add ipv4-or-v6 display hint
The attribute WGALLOWEDIP_A_IPADDR can contain either an IPv4 or an IPv6 address depending on WGALLOWEDIP_A_FAMILY, however in practice it is enough to look at the attribute length.
This patch implements an ipv4-or-v6 display hint, that can deal with this kind of attribute.
It only implements this display hint for genetlink-legacy, it can be added to other protocol variants if needed, but we don't want to encourage it's use.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20250915144301.725949-12-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 52550d51 | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl: decode hex input
This patch adds support for decoding hex input, so that binary attributes can be read through --json.
Example (using future wireguard.yaml): $ sudo ./tools/net/ynl/pyy
tools: ynl: decode hex input
This patch adds support for decoding hex input, so that binary attributes can be read through --json.
Example (using future wireguard.yaml): $ sudo ./tools/net/ynl/pyynl/cli.py --family wireguard \ --do set-device --json '{"ifindex":3, "private-key":"2a ae 6c 35 c9 4f cf <... to 32 bytes>"}'
In order to somewhat mirror what is done in _formatted_string(), then for non-binary attributes attempt to convert it to an int.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20250915144301.725949-11-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 5c51ae24 | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl: encode indexed-arrays
This patch adds support for encoding indexed-array attributes with sub-type nest in pyynl.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Don
tools: ynl: encode indexed-arrays
This patch adds support for encoding indexed-array attributes with sub-type nest in pyynl.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20250915144301.725949-10-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 328c1342 | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl: move nest packing to a helper function
This patch moves nest packing into a helper function, that can also be used for packing indexed arrays.
No behavioural changes intended.
Signed-o
tools: ynl: move nest packing to a helper function
This patch moves nest packing into a helper function, that can also be used for packing indexed arrays.
No behavioural changes intended.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20250915144301.725949-9-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| a44a93ea | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl-gen: rename TypeArrayNest to TypeIndexedArray
Since TypeArrayNest can now be used with many other sub-types than nest, then rename it to TypeIndexedArray, to reduce confusion.
This patch
tools: ynl-gen: rename TypeArrayNest to TypeIndexedArray
Since TypeArrayNest can now be used with many other sub-types than nest, then rename it to TypeIndexedArray, to reduce confusion.
This patch continues the rename, that was started in commit aa6485d813ad ("ynl: rename array-nest to indexed-array"), when the YNL type was renamed.
In order to get rid of all references to the old naming, within ynl, then renaming some variables in _multi_parse().
This is a trivial patch with no behavioural changes intended.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20250915144301.725949-8-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 1d99aa4e | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl-gen: validate nested arrays
In nested arrays don't require that the intermediate attribute type should be a valid attribute type, it might just be zero or an incrementing index, it is oft
tools: ynl-gen: validate nested arrays
In nested arrays don't require that the intermediate attribute type should be a valid attribute type, it might just be zero or an incrementing index, it is often not even used.
See include/net/netlink.h about NLA_NESTED_ARRAY: > The difference to NLA_NESTED is the structure: > NLA_NESTED has the nested attributes directly inside > while an array has the nested attributes at another > level down and the attribute types directly in the > nesting don't matter.
Example based on include/uapi/linux/wireguard.h: > WGDEVICE_A_PEERS: NLA_NESTED > 0: NLA_NESTED > WGPEER_A_PUBLIC_KEY: NLA_EXACT_LEN, len WG_KEY_LEN > [..] > 0: NLA_NESTED > ... > ...
Previous the check required that the nested type was valid in the parent attribute set, which in this case resolves to WGDEVICE_A_UNSPEC, which is YNL_PT_REJECT, and it took the early exit and returned YNL_PARSE_CB_ERROR.
This patch renames the old nl_attr_validate() to __nl_attr_validate(), and creates a new inline function nl_attr_validate() to mimic the old one.
The new __nl_attr_validate() takes the attribute type as an argument, so we can use it to validate attributes of a nested attribute, in the context of the parents attribute type, which in the above case is generated as: [WGDEVICE_A_PEERS] = { .name = "peers", .type = YNL_PT_NEST, .nest = &wireguard_wgpeer_nest, },
__nl_attr_validate() only checks if the attribute length is plausible for a given attribute type, so the .nest in the above example is not used.
As the new inline function needs to be defined after ynl_attr_type(), then the definitions are moved down, so we avoid a forward declaration of ynl_attr_type().
Some other examples are NL80211_BAND_ATTR_FREQS (nest) and NL80211_ATTR_SUPPORTED_COMMANDS (u32) both in nl80211-user.c $ make -C tools/net/ynl/generated nl80211-user.c
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20250915144301.725949-7-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 099902fc | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl-gen: avoid repetitive variables definitions
In the generated attribute parsing code, avoid repetitively defining the same variables over and over again, local to the conditional block for
tools: ynl-gen: avoid repetitive variables definitions
In the generated attribute parsing code, avoid repetitively defining the same variables over and over again, local to the conditional block for each attribute.
This patch consolidates the definitions of local variables for attribute parsing, so that they are defined at the function level, and re-used across attributes, thus making the generated code read more natural.
If attributes defines identical local_vars, then they will be deduplicated, attributes are assumed to only use their local variables transiently.
The example below shows how `len` was defined repeatedly in tools/net/ynl/generated/nl80211-user.c:
nl80211_iftype_data_attrs_parse(..) { [..] ynl_attr_for_each_nested(attr, nested) { unsigned int type = ynl_attr_type(attr);
if (type == NL80211_BAND_IFTYPE_ATTR_IFTYPES) { unsigned int len; [..] } else if (type == NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC) { unsigned int len; [..] [same pattern 8 times, so 11 times in total] } else if (type == NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE) { unsigned int len; [..] } } return 0; }
This patch results in this diffstat for the generated code:
$ diff -Naur pre/ post/ | diffstat devlink-user.c | 187 +++---------------- dpll-user.c | 10 - ethtool-user.c | 49 +---- fou-user.c | 5 handshake-user.c | 3 mptcp_pm-user.c | 3 nfsd-user.c | 16 - nl80211-user.c | 159 +--------------- nlctrl-user.c | 21 -- ovpn-user.c | 7 ovs_datapath-user.c | 9 ovs_flow-user.c | 89 --------- ovs_vport-user.c | 7 rt-addr-user.c | 14 - rt-link-user.c | 183 ++---------------- rt-neigh-user.c | 14 - rt-route-user.c | 26 -- rt-rule-user.c | 11 - tc-user.c | 380 +++++---------------------------------- tcp_metrics-user.c | 7 team-user.c | 5 21 files changed, 175 insertions(+), 1030 deletions(-)
The changed lines are mostly `unsigned int len;` definitions:
$ diff -Naur pre/ post/ | grep ^[-+] | grep -v '^[-+]\{3\}' | grep -v '^.$' | sed -e 's/\t\+/ /g' | sort | uniq -c | sort -nr 488 - unsigned int len; 153 + unsigned int len; 24 - const struct nlattr *attr2; 18 + const struct nlattr *attr2; 1 - __u32 policy_id, attr_id; 1 + __u32 policy_id, attr_id; 1 - __u32 op_id; 1 + __u32 op_id; 1 - const struct nlattr *attr_policy_id, *attr_attr_id; 1 + const struct nlattr *attr_policy_id, *attr_attr_id; 1 - const struct nlattr *attr_op_id; 1 + const struct nlattr *attr_op_id;
Suggested-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20250915144301.725949-6-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| db4ea3ba | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl-gen: refactor local vars for .attr_put() callers
Refactor the generation of local variables needed when building requests, by moving the logic from put_req_nested() into a new helper put_
tools: ynl-gen: refactor local vars for .attr_put() callers
Refactor the generation of local variables needed when building requests, by moving the logic from put_req_nested() into a new helper put_local_vars(), and use the helper before .attr_put() is called, thus generating the local variables assumed by .attr_put().
Previously only put_req_nested() generated the variables assumed by .attr_put(), print_req() only generated the count iterator `i`, and print_dump() neither generated `i` nor `array`.
This patch fixes the build errors below: $ make -C tools/net/ynl/generated/ [...] -e GEN wireguard-user.c -e GEN wireguard-user.h -e CC wireguard-user.o wireguard-user.c: In function ‘wireguard_get_device_dump’: wireguard-user.c:480:9: error: ‘array’ undeclared (first use in func) 480 | array = ynl_attr_nest_start(nlh, WGDEVICE_A_PEERS); | ^~~~~ wireguard-user.c:480:9: note: each undeclared identifier is reported only once for each function it appears in wireguard-user.c:481:14: error: ‘i’ undeclared (first use in func) 481 | for (i = 0; i < req->_count.peers; i++) | ^ wireguard-user.c: In function ‘wireguard_set_device’: wireguard-user.c:533:9: error: ‘array’ undeclared (first use in func) 533 | array = ynl_attr_nest_start(nlh, WGDEVICE_A_PEERS); | ^~~~~ make: *** [Makefile:52: wireguard-user.o] Error 1 make: Leaving directory '/usr/src/linux/tools/net/ynl/generated'
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20250915144301.725949-5-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 8df78d97 | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl-gen: add sub-type check
Add a check to verify that the sub-type is "nest", and throw an exception if no policy could be generated, as a guard to prevent against generating a bad policy.
tools: ynl-gen: add sub-type check
Add a check to verify that the sub-type is "nest", and throw an exception if no policy could be generated, as a guard to prevent against generating a bad policy.
This is a trivial patch with no behavioural changes intended.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/20250915144301.725949-4-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| d0bdfe36 | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl-gen: generate nested array policies
This patch adds support for NLA_POLICY_NESTED_ARRAY() policies.
Example spec (from future wireguard.yaml): - name: wgpeer attributes: -
tools: ynl-gen: generate nested array policies
This patch adds support for NLA_POLICY_NESTED_ARRAY() policies.
Example spec (from future wireguard.yaml): - name: wgpeer attributes: - name: allowedips type: indexed-array sub-type: nest nested-attributes: wgallowedip
yields NLA_POLICY_NESTED_ARRAY(wireguard_wgallowedip_nl_policy).
This doesn't change any currently generated code, as it isn't used in any specs currently used for generating code.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20250915144301.725949-3-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 3ff5258b | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl-gen: allow overriding name-prefix for constants
Allow using custom name-prefix with constants, just like it is for enum and flags declarations.
This is needed for generating WG_KEY_LEN i
tools: ynl-gen: allow overriding name-prefix for constants
Allow using custom name-prefix with constants, just like it is for enum and flags declarations.
This is needed for generating WG_KEY_LEN in include/uapi/linux/wireguard.h from a spec.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/20250915144301.725949-2-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| a6824f65 | 15-Sep-2025 |
Vladimir Oltean <vladimir.oltean@nxp.com> |
tools: ynl: avoid "use of uninitialized variable" false positive in generated code
With indexed-array types such as "ops" from Documentation/netlink/specs/nlctrl.yaml, the generator creates code suc
tools: ynl: avoid "use of uninitialized variable" false positive in generated code
With indexed-array types such as "ops" from Documentation/netlink/specs/nlctrl.yaml, the generator creates code such as:
int nlctrl_getfamily_rsp_parse(const struct nlmsghdr *nlh, struct ynl_parse_arg *yarg) { struct nlctrl_getfamily_rsp *dst; const struct nlattr *attr_ops; const struct nlattr *attr; struct ynl_parse_arg parg; unsigned int n_ops = 0; int i;
...
ynl_attr_for_each(attr, nlh, yarg->ys->family->hdr_len) { unsigned int type = ynl_attr_type(attr);
if (type == CTRL_ATTR_FAMILY_ID) { ... } else if (type == CTRL_ATTR_OPS) { const struct nlattr *attr2;
attr_ops = attr; ynl_attr_for_each_nested(attr2, attr) { if (ynl_attr_validate(yarg, attr2)) return YNL_PARSE_CB_ERROR; n_ops++; } } else { ... } } if (n_ops) { dst->ops = calloc(n_ops, sizeof(*dst->ops)); dst->_count.ops = n_ops; i = 0; parg.rsp_policy = &nlctrl_op_attrs_nest; ynl_attr_for_each_nested(attr, attr_ops) { ... } }
return YNL_PARSE_CB_OK; }
It is clear that due to the sequential nature of code execution, when n_ops (initially zero) is incremented, attr_ops is also assigned from the value of "attr" (the current iterator).
But some compilers, like gcc version 12.2.0 (Debian 12.2.0-14+deb12u1) as distributed by Debian Bookworm, seem to be not sophisticated enough to see this, and fail to compile (warnings treated as errors):
In file included from ../lib/ynl.h:10, from nlctrl-user.c:9: In function ‘ynl_attr_data_end’, inlined from ‘nlctrl_getfamily_rsp_parse’ at nlctrl-user.c:427:3: ../lib/ynl-priv.h:209:44: warning: ‘attr_ops’ may be used uninitialized [-Wmaybe-uninitialized] 209 | return (char *)ynl_attr_data(attr) + ynl_attr_data_len(attr); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ nlctrl-user.c: In function ‘nlctrl_getfamily_rsp_parse’: nlctrl-user.c:341:30: note: ‘attr_ops’ was declared here 341 | const struct nlattr *attr_ops; | ^~~~~~~~
It is a pity that we have to do this, but I see no other way than to suppress the false positive by appeasing the compiler and initializing the "*attr_{aspec.c_name}" variable with a bogus value (NULL). This will never be used - at runtime it will always be overwritten when "n_{struct[anest].c_name}" is non-zero.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://patch.msgid.link/20250915144414.1185788-1-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| f6259ba7 | 09-Sep-2025 |
Matthieu Baerts (NGI0) <matttbe@kernel.org> |
tools: ynl: check for membership with 'not in'
It is better to use 'not in' instead of 'not {element} in {collection}' according to Ruff.
This is linked to Ruff error E713 [1]:
Testing membershi
tools: ynl: check for membership with 'not in'
It is better to use 'not in' instead of 'not {element} in {collection}' according to Ruff.
This is linked to Ruff error E713 [1]:
Testing membership with {element} not in {collection} is more readable.
Link: https://docs.astral.sh/ruff/rules/not-in-test/ [1] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Link: https://patch.msgid.link/20250909-net-next-ynl-ruff-v1-8-238c2bccdd99@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 10d32b0d | 09-Sep-2025 |
Matthieu Baerts (NGI0) <matttbe@kernel.org> |
tools: ynl: use 'cond is None'
It is better to use the 'is' keyword instead of comparing to None according to Ruff.
This is linked to Ruff error E711 [1]:
According to PEP 8, "Comparisons to sin
tools: ynl: use 'cond is None'
It is better to use the 'is' keyword instead of comparing to None according to Ruff.
This is linked to Ruff error E711 [1]:
According to PEP 8, "Comparisons to singletons like None should always be done with is or is not, never the equality operators."
Link: https://docs.astral.sh/ruff/rules/none-comparison/ [1] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Link: https://patch.msgid.link/20250909-net-next-ynl-ruff-v1-7-238c2bccdd99@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 616129d6 | 09-Sep-2025 |
Matthieu Baerts (NGI0) <matttbe@kernel.org> |
tools: ynl: remove unnecessary semicolons
These semicolons are not required according to Ruff. Simply remove them.
This is linked to Ruff error E703 [1]:
A trailing semicolon is unnecessary and
tools: ynl: remove unnecessary semicolons
These semicolons are not required according to Ruff. Simply remove them.
This is linked to Ruff error E703 [1]:
A trailing semicolon is unnecessary and should be removed.
Link: https://docs.astral.sh/ruff/rules/useless-semicolon/ [1] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Link: https://patch.msgid.link/20250909-net-next-ynl-ruff-v1-6-238c2bccdd99@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 389712b0 | 09-Sep-2025 |
Matthieu Baerts (NGI0) <matttbe@kernel.org> |
tools: ynl: remove unused imports
These imports are not used according to Ruff, and can be safely removed.
This is linked to Ruff error F401 [1]:
Unused imports add a performance overhead at run
tools: ynl: remove unused imports
These imports are not used according to Ruff, and can be safely removed.
This is linked to Ruff error F401 [1]:
Unused imports add a performance overhead at runtime, and risk creating import cycles. They also increase the cognitive load of reading the code.
There is one exception with 'YnlDocGenerator' which is added in __all__: it is used by ynl_gen_rst.py.
Link: https://docs.astral.sh/ruff/rules/unused-import/ [1] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Link: https://patch.msgid.link/20250909-net-next-ynl-ruff-v1-5-238c2bccdd99@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| d8e0e254 | 09-Sep-2025 |
Matthieu Baerts (NGI0) <matttbe@kernel.org> |
tools: ynl: remove f-string without any placeholders
'f-strings' without any placeholders don't need to be marked as such according to Ruff. This 'f' can be safely removed.
This is linked to Ruff e
tools: ynl: remove f-string without any placeholders
'f-strings' without any placeholders don't need to be marked as such according to Ruff. This 'f' can be safely removed.
This is linked to Ruff error F541 [1]:
f-strings are a convenient way to format strings, but they are not necessary if there are no placeholder expressions to format. In this case, a regular string should be used instead, as an f-string without placeholders can be confusing for readers, who may expect such a placeholder to be present.
Link: https://docs.astral.sh/ruff/rules/f-string-missing-placeholders/ [1] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Link: https://patch.msgid.link/20250909-net-next-ynl-ruff-v1-4-238c2bccdd99@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 02962ddb | 09-Sep-2025 |
Matthieu Baerts (NGI0) <matttbe@kernel.org> |
tools: ynl: remove assigned but never used variable
These variables are assigned but never used according to Ruff. They can then be safely removed.
This is linked to Ruff error F841 [1]:
A varia
tools: ynl: remove assigned but never used variable
These variables are assigned but never used according to Ruff. They can then be safely removed.
This is linked to Ruff error F841 [1]:
A variable that is defined but not used is likely a mistake, and should be removed to avoid confusion.
Link: https://docs.astral.sh/ruff/rules/unused-variable/ [1] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Link: https://patch.msgid.link/20250909-net-next-ynl-ruff-v1-3-238c2bccdd99@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 287bc89b | 09-Sep-2025 |
Matthieu Baerts (NGI0) <matttbe@kernel.org> |
tools: ynl: avoid bare except
This 'except' was used without specifying the exception class according to Ruff. Here, only the ValueError class is expected and handled.
This is linked to Ruff error
tools: ynl: avoid bare except
This 'except' was used without specifying the exception class according to Ruff. Here, only the ValueError class is expected and handled.
This is linked to Ruff error E722 [1]:
A bare except catches BaseException which includes KeyboardInterrupt, SystemExit, Exception, and others. Catching BaseException can make it hard to interrupt the program (e.g., with Ctrl-C) and can disguise other problems.
Link: https://docs.astral.sh/ruff/rules/bare-except/ [1] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Link: https://patch.msgid.link/20250909-net-next-ynl-ruff-v1-2-238c2bccdd99@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|