From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id DD850239 for ; Wed, 13 Mar 2019 03:12:57 +0100 (CET) Received: by mail-pf1-f194.google.com with SMTP id j5so266018pfa.2 for ; Tue, 12 Mar 2019 19:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=ZshfBc6Ite1U+m3cNedCpqLpf71nBko52TmjBjpKaBM=; b=xGDr+L3T9K0h26Ll4EPZGSuAm6ZdYg15963b/erIYxbZ13o0JbT6A86dn0skpvp88T 3GG3aFtSPQth2PJayzSl9K4UDsXkND0ea++nVegiVzR1teQoJHq2WtXdXIQaxKv7jFng M/nXoHu3y60XKseL6AOtVV6XUUIOcaZMZwHzSiPniwUqlEw7fStXmIFC0zhEpssionLx SDtbykM7JFYDZKrUozFRrqHu3Kixg+y7n7pLaUNbhRPG8xxLCXVyPNdjUuCRSdsi6OF2 jjic2kYTFBBAlrZdCx0XsS0SMQKyrUv37+aU4ma3FCzXSylvw/JgD8mjpv13s87FogVn WXow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZshfBc6Ite1U+m3cNedCpqLpf71nBko52TmjBjpKaBM=; b=VdJG+Ic0p5teLyGjDpnu5FpgS3hoG/xPDpaNzk8zlA3pIg0BrJXhKSZd3lyGUDNEaj EMQ8VDaC0LjsgP65ZD8ie7YTzpQZwnYlYKv9hjMSyvjAEVPSBzcfwyS+Pm1QLwrawyhG EVCc/rvCAOFTojPzbDsY7h17UzheuLQs1JVzO1YYExCg79aCh9fPFrjlin1g6DCtSUfc s050cIQAzFBDWbaiTj3s4WpvkaajIhSnUltJigkmF9DCqtgDibtvg/62+xLbMyJgRM7N NETcNST/pR4WinRpGDN6JXmlYoFswyGc8v2vGTnOWcaDY9mA15UbRDfKtT0+aG66lttf EYsQ== X-Gm-Message-State: APjAAAU4dtOyJIDJr8Z7uKbHq57ACh5UnhYXm4q5W5lN6tBLkWhl1v+l cvpSpTe+c9CY4BmSzLtWWI3B9w== X-Google-Smtp-Source: APXvYqzEXo37Hd2kvrHUp1Y/1wPn1wOKdtVXNnpCQkjtQa8Zop0nQDoM6ZsGddU0ikxU/sVTDs5FfQ== X-Received: by 2002:a17:902:681:: with SMTP id 1mr43040862plh.185.1552443176664; Tue, 12 Mar 2019 19:12:56 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id m64sm23798149pfi.149.2019.03.12.19.12.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 19:12:55 -0700 (PDT) From: Stephen Hemminger To: matan@mellanox.com Cc: dev@dpdk.org, Stephen Hemminger Date: Tue, 12 Mar 2019 19:12:53 -0700 Message-Id: <20190313021253.525-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/vdev_netvsc: fix erronous cast X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2019 02:12:58 -0000 The return value from bus->find_device is a rte_device which is not safe to cast to a rte_vdev_device structure. It doesn't really matter since only being checked for NULL but static checkers might find a bug here. Signed-off-by: Stephen Hemminger --- drivers/net/vdev_netvsc/vdev_netvsc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index ba63fac2a598..801f54c96e01 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -808,7 +808,7 @@ vdev_netvsc_cmp_rte_device(const struct rte_device *dev1, static void vdev_netvsc_scan_callback(__rte_unused void *arg) { - struct rte_vdev_device *dev; + struct rte_device *dev; struct rte_devargs *devargs; struct rte_bus *vbus = rte_bus_find_by_name("vdev"); @@ -816,8 +816,9 @@ vdev_netvsc_scan_callback(__rte_unused void *arg) if (!strncmp(devargs->name, VDEV_NETVSC_DRIVER_NAME, VDEV_NETVSC_DRIVER_NAME_LEN)) return; - dev = (struct rte_vdev_device *)vbus->find_device(NULL, - vdev_netvsc_cmp_rte_device, VDEV_NETVSC_DRIVER_NAME); + + dev = vbus->find_device(NULL, vdev_netvsc_cmp_rte_device, + VDEV_NETVSC_DRIVER_NAME); if (dev) return; if (rte_devargs_add(RTE_DEVTYPE_VIRTUAL, VDEV_NETVSC_DRIVER_NAME)) -- 2.17.1