[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <243100a2-abb4-6df4-235e-42a773716309@intel.com>
Date: Mon, 21 Nov 2022 11:10:37 -0800
From: Jacob Keller <jacob.e.keller@...el.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: <netdev@...r.kernel.org>, Jiri Pirko <jiri@...dia.com>
Subject: Re: [PATCH net-next 3/8] devlink: report extended error message in
region_read_dumpit
On 11/18/2022 5:40 PM, Jakub Kicinski wrote:
> On Thu, 17 Nov 2022 14:07:58 -0800 Jacob Keller wrote:
>> Report extended error details in the devlink_nl_cmd_region_read_dumpit
>> function, by using the extack structure from the netlink_callback.
>>
>> Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
>> ---
>> net/core/devlink.c | 14 ++++++++++++--
>> 1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/core/devlink.c b/net/core/devlink.c
>> index 932476956d7e..f2ee1da5283c 100644
>> --- a/net/core/devlink.c
>> +++ b/net/core/devlink.c
>> @@ -6453,8 +6453,14 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
>>
>> devl_lock(devlink);
>>
>> - if (!attrs[DEVLINK_ATTR_REGION_NAME] ||
>> - !attrs[DEVLINK_ATTR_REGION_SNAPSHOT_ID]) {
>> + if (!attrs[DEVLINK_ATTR_REGION_NAME]) {
>> + NL_SET_ERR_MSG_MOD(cb->extack, "No region name provided");
>> + err = -EINVAL;
>> + goto out_unlock;
>> + }
>> +
>> + if (!attrs[DEVLINK_ATTR_REGION_SNAPSHOT_ID]) {
>
> Please use GENL_REQ_ATTR_CHECK() instead of adding strings.
>
Ahhh. Figured out why GENL_REQ_ATTR_CHECK wasn't used here already. It
happens because the dumpit functions don't get a genl_info * struct,
they get a netlink_cb and a genl_dumpit_info.
I can look at improving this.
Thanks,
Jake
Powered by blists - more mailing lists