summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJianfeng Tan <jianfeng.tan@intel.com>2016-07-05 11:42:59 +0000
committerYuanhan Liu <yuanhan.liu@linux.intel.com>2016-07-05 14:14:40 +0200
commit3bd60a27e9f2afacff70f6aafdca0fc18685633f (patch)
treef9152a23eec56eacc747802fbdc499b03ee14481 /drivers
parentc34673bb005e0d219c8774fe97e43067ab1d56a7 (diff)
downloaddpdk-3bd60a27e9f2afacff70f6aafdca0fc18685633f.zip
dpdk-3bd60a27e9f2afacff70f6aafdca0fc18685633f.tar.gz
dpdk-3bd60a27e9f2afacff70f6aafdca0fc18685633f.tar.xz
net/virtio: fix null pointer dereference
There is a logic bug in this code, that could lead to null pointer dereference when cvq is NULL. Fix this problem by changing logic && to logic ||. >> CID 127480: Null pointer dereferences (FORWARD_NULL) >> Dereferencing null pointer "cvq". if (!cvq && !cvq->vq) { ... } Coverity issue: 127480 Fixes: 01ad44fd374f ("net/virtio: split Rx/Tx queue") Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/virtio/virtio_ethdev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index e6c2ac2..8467b3c 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -166,7 +166,7 @@ virtio_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,
ctrl->status = status;
- if (!cvq && !cvq->vq) {
+ if (!cvq || !cvq->vq) {
PMD_INIT_LOG(ERR, "Control queue is not supported.");
return -1;
}