diff mbox series

[iproute2] nexthop: fix error reporting in filter dump

Message ID 07545342394d8a8477f81ecbc1909079bfeeb78e.1583842365.git.aclaudi@redhat.com
State Accepted
Delegated to: stephen hemminger
Headers show
Series [iproute2] nexthop: fix error reporting in filter dump | expand

Commit Message

Andrea Claudi March 10, 2020, 12:15 p.m. UTC
nh_dump_filter is missing a return value check in two cases.
Fix this simply adding an assignment to the proper variable.

Fixes: 63df8e8543b03 ("Add support for nexthop objects")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
 ip/ipnexthop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Ahern March 10, 2020, 5:43 p.m. UTC | #1
On 3/10/20 6:15 AM, Andrea Claudi wrote:
> nh_dump_filter is missing a return value check in two cases.
> Fix this simply adding an assignment to the proper variable.
> 
> Fixes: 63df8e8543b03 ("Add support for nexthop objects")
> Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
> ---
>  ip/ipnexthop.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c
> index 9f860c8cea251..99f89630ed189 100644
> --- a/ip/ipnexthop.c
> +++ b/ip/ipnexthop.c
> @@ -59,13 +59,13 @@ static int nh_dump_filter(struct nlmsghdr *nlh, int reqlen)
>  	}
>  
>  	if (filter.groups) {
> -		addattr_l(nlh, reqlen, NHA_GROUPS, NULL, 0);
> +		err = addattr_l(nlh, reqlen, NHA_GROUPS, NULL, 0);
>  		if (err)
>  			return err;
>  	}
>  
>  	if (filter.master) {
> -		addattr32(nlh, reqlen, NHA_MASTER, filter.master);
> +		err = addattr32(nlh, reqlen, NHA_MASTER, filter.master);
>  		if (err)
>  			return err;
>  	}
> 

Reviewed-by: David Ahern <dsahern@gmail.com>
Stephen Hemminger March 15, 2020, 4:56 p.m. UTC | #2
On Tue, 10 Mar 2020 13:15:17 +0100
Andrea Claudi <aclaudi@redhat.com> wrote:

> nh_dump_filter is missing a return value check in two cases.
> Fix this simply adding an assignment to the proper variable.
> 
> Fixes: 63df8e8543b03 ("Add support for nexthop objects")
> Signed-off-by: Andrea Claudi <aclaudi@redhat.com>

Applied, thanks
diff mbox series

Patch

diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c
index 9f860c8cea251..99f89630ed189 100644
--- a/ip/ipnexthop.c
+++ b/ip/ipnexthop.c
@@ -59,13 +59,13 @@  static int nh_dump_filter(struct nlmsghdr *nlh, int reqlen)
 	}
 
 	if (filter.groups) {
-		addattr_l(nlh, reqlen, NHA_GROUPS, NULL, 0);
+		err = addattr_l(nlh, reqlen, NHA_GROUPS, NULL, 0);
 		if (err)
 			return err;
 	}
 
 	if (filter.master) {
-		addattr32(nlh, reqlen, NHA_MASTER, filter.master);
+		err = addattr32(nlh, reqlen, NHA_MASTER, filter.master);
 		if (err)
 			return err;
 	}