Re: [PATCH net-next v3 08/13] tools: ynl-gen: only validate nested array payload
From: Asbjørn Sloth Tønnesen <hidden>
Date: 2025-09-13 23:14:57
Also in:
lkml
From: Asbjørn Sloth Tønnesen <hidden>
Date: 2025-09-13 23:14:57
Also in:
lkml
On 9/13/25 12:27 AM, Jakub Kicinski wrote:
On Thu, 11 Sep 2025 20:05:01 +0000 Asbjørn Sloth Tønnesen wrote:quoted
+int ynl_attr_validate_payload(struct ynl_parse_arg *yarg, + const struct nlattr *attr, unsigned int type) +{ + return __ynl_attr_validate(yarg, attr, type); +}Why not expose __ynl_attr_validate() to the callers? I don't think the _payload() suffix is crystal clear, we're still validating attr, _payload() makes it sound like we're validating what's inside attr?
I didn't wanna call __ynl_attr_validate() directly, as the only __ynl_* function in ynl-priv.h is __ynl_attr_put_overflow(), and that is only used in other static functions within that file. I agree, that _payload() might not be the best given that we currently don't look deeper than validating that the length a bit, so maybe _length() would have been better. In v4, I have changed it to just expose __ynl_attr_validate() in ynl-priv.h, and changed ynl_attr_validate() to an inline function.