libtle_udp: fix possible dereference of NULL ptr in tle_udp_del_dev() 13/3313/1
authorKonstantin Ananyev <konstantin.ananyev@intel.com>
Fri, 7 Oct 2016 10:58:00 +0000 (11:58 +0100)
committerKonstantin Ananyev <konstantin.ananyev@intel.com>
Fri, 7 Oct 2016 12:57:55 +0000 (13:57 +0100)
Change-Id: I09661a97206e8714c05f4c4f31d23d250cd0933a
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/libtle_udp/udp_ctl.c

index 618a7ef..c8580ac 100644 (file)
@@ -395,11 +395,10 @@ tle_udp_del_dev(struct tle_udp_dev *dev)
        uint32_t p;
        struct tle_udp_ctx *ctx;
 
-       ctx = dev->ctx;
-
        if (dev == NULL || dev->ctx == NULL)
                return -EINVAL;
 
+       ctx = dev->ctx;
        p = dev - ctx->dev;
 
        if (p >= RTE_DIM(ctx->dev) ||