[systemd-commits] 2 commits - src/libsystemd

Tom Gundersen tomegun at kemper.freedesktop.org
Thu Feb 26 14:31:12 PST 2015


 src/libsystemd/sd-rtnl/rtnl-types.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit 09c41feef3dbbdba36ad7bf3928ba4e29dee79c3
Author: Tom Gundersen <teg at jklm.no>
Date:   Wed Feb 25 15:29:37 2015 -0500

    sd-rtnl: types - fix check for unsupported type
    
    Spotted by Thomas H.P. Andersen <phomes at gmail.com>

diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c
index 40dee56..557dc59 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -524,8 +524,7 @@ int type_system_union_protocol_get_type_system(const NLTypeSystemUnion *type_sys
                 return -ENOTSUP;
 
         type_system = &type_system_union->type_systems[protocol];
-
-        if (!type_system)
+        if (type_system->max == 0)
                 return -ENOTSUP;
 
         *ret = type_system;

commit f8a6ca1babe0afea6cd5cc8006077cbe93243b8f
Author: Tom Gundersen <teg at jklm.no>
Date:   Wed Feb 25 15:28:48 2015 -0500

    sd-rtnl: types - don't assert_return in private API

diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c
index 2257c81..40dee56 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -465,8 +465,7 @@ int type_system_get_type_system(const NLTypeSystem *type_system, const NLTypeSys
         if (r < 0)
                 return r;
 
-        assert_return(nl_type->type == NLA_NESTED, -EINVAL);
-
+        assert(nl_type->type == NLA_NESTED);
         assert(nl_type->type_system);
 
         *ret = nl_type->type_system;
@@ -484,8 +483,7 @@ int type_system_get_type_system_union(const NLTypeSystem *type_system, const NLT
         if (r < 0)
                 return r;
 
-        assert_return(nl_type->type == NLA_UNION, -EINVAL);
-
+        assert(nl_type->type == NLA_UNION);
         assert(nl_type->type_system_union);
 
         *ret = nl_type->type_system_union;
@@ -497,7 +495,7 @@ int type_system_union_get_type_system(const NLTypeSystemUnion *type_system_union
         int type;
 
         assert(type_system_union);
-        assert_return(type_system_union->match_type == NL_MATCH_SIBLING, -EINVAL);
+        assert(type_system_union->match_type == NL_MATCH_SIBLING);
         assert(type_system_union->lookup);
         assert(type_system_union->type_systems);
         assert(ret);
@@ -519,9 +517,8 @@ int type_system_union_protocol_get_type_system(const NLTypeSystemUnion *type_sys
 
         assert(type_system_union);
         assert(type_system_union->type_systems);
+        assert(type_system_union->match_type == NL_MATCH_PROTOCOL);
         assert(ret);
-        assert_return(type_system_union->match_type == NL_MATCH_PROTOCOL, -EINVAL);
-        assert_return(protocol < type_system_union->num, -EINVAL);
 
         if (protocol >= type_system_union->num)
                 return -ENOTSUP;



More information about the systemd-commits mailing list