diff mbox series

[ovs-dev] dpif-netlink: Fix error behavior in dpif_netlink_port_add__().

Message ID 20181115170818.28115-1-blp@ovn.org
State Accepted
Headers show
Series [ovs-dev] dpif-netlink: Fix error behavior in dpif_netlink_port_add__(). | expand

Commit Message

Ben Pfaff Nov. 15, 2018, 5:08 p.m. UTC
Until now, the code here would report an error to its caller as success.
This fixes the problem.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 lib/dpif-netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Alin-Gabriel Serdean Nov. 15, 2018, 5:27 p.m. UTC | #1
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>


> -----Mesaj original-----
> De la: ovs-dev-bounces@openvswitch.org <ovs-dev-
> bounces@openvswitch.org> În numele Ben Pfaff
> Trimis: Thursday, November 15, 2018 7:08 PM
> Către: dev@openvswitch.org
> Cc: Ben Pfaff <blp@ovn.org>
> Subiect: [ovs-dev] [PATCH] dpif-netlink: Fix error behavior in
> dpif_netlink_port_add__().
> 
> Until now, the code here would report an error to its caller as success.
> This fixes the problem.
> 
> Found by inspection.
> 
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  lib/dpif-netlink.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index
> f2011f22e548..7f6a6cc59592 100644
> --- a/lib/dpif-netlink.c
> +++ b/lib/dpif-netlink.c
> @@ -716,7 +716,8 @@ dpif_netlink_port_add__(struct dpif_netlink *dpif,
> const char *name,
>      int error = 0;
> 
>      if (dpif->handlers) {
> -        if (nl_sock_create(NETLINK_GENERIC, &socksp)) {
> +        error = nl_sock_create(NETLINK_GENERIC, &socksp);
> +        if (error) {
>              return error;
>          }
>      }
> --
> 2.16.1
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Ben Pfaff Nov. 15, 2018, 5:36 p.m. UTC | #2
Thanks, applied and backported.

On Thu, Nov 15, 2018 at 07:27:11PM +0200, aserdean@ovn.org wrote:
> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
> 
> 
> > -----Mesaj original-----
> > De la: ovs-dev-bounces@openvswitch.org <ovs-dev-
> > bounces@openvswitch.org> În numele Ben Pfaff
> > Trimis: Thursday, November 15, 2018 7:08 PM
> > Către: dev@openvswitch.org
> > Cc: Ben Pfaff <blp@ovn.org>
> > Subiect: [ovs-dev] [PATCH] dpif-netlink: Fix error behavior in
> > dpif_netlink_port_add__().
> > 
> > Until now, the code here would report an error to its caller as success.
> > This fixes the problem.
> > 
> > Found by inspection.
> > 
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> > ---
> >  lib/dpif-netlink.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index
> > f2011f22e548..7f6a6cc59592 100644
> > --- a/lib/dpif-netlink.c
> > +++ b/lib/dpif-netlink.c
> > @@ -716,7 +716,8 @@ dpif_netlink_port_add__(struct dpif_netlink *dpif,
> > const char *name,
> >      int error = 0;
> > 
> >      if (dpif->handlers) {
> > -        if (nl_sock_create(NETLINK_GENERIC, &socksp)) {
> > +        error = nl_sock_create(NETLINK_GENERIC, &socksp);
> > +        if (error) {
> >              return error;
> >          }
> >      }
> > --
> > 2.16.1
> > 
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index f2011f22e548..7f6a6cc59592 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -716,7 +716,8 @@  dpif_netlink_port_add__(struct dpif_netlink *dpif, const char *name,
     int error = 0;
 
     if (dpif->handlers) {
-        if (nl_sock_create(NETLINK_GENERIC, &socksp)) {
+        error = nl_sock_create(NETLINK_GENERIC, &socksp);
+        if (error) {
             return error;
         }
     }