Subject: Re: [PATCH net-next 3/8] devlink: report extended error message in region_read_dumpit

From: Jakub Kicinski <[email-masked]>
Date: Mon, 21 Nov 2022 11:23:22 -0800

On Mon, 21 Nov 2022 11:10:37 -0800 Jacob Keller wrote:
> >> @@ -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.

Ah damn, you're right, I thought I just missed it because it wasn't 
at the top of the function.