From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 15BD31B3A9 for ; Mon, 6 Aug 2018 20:11:21 +0200 (CEST) Received: by mail-pg1-f195.google.com with SMTP id k3-v6so6578856pgq.5 for ; Mon, 06 Aug 2018 11:11:21 -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:in-reply-to:references; bh=Z2CtOy6KdQkaZanqPqxStSpV8o3G43Rg43XLi2pvEZc=; b=XWsxoqSkLCCcAz+NCve/zlTskXwR9ZSgxsqWJ0RNuESDLL7EcfR2nLi5WQ7vjXHU+Y oVv7oRDuqDeUVtvVBvX5InvRQ92YxiyTNTaY5ESr0eRSFdP5W5FE84IHXwrog+4qQ86D MSKc8AFOMA13jgNcqc/EY/BTO21q5KIRw79nmnx9+8OgF3tcxzwaSRBHjQbx5bg4nQ2C nPiWueszZRRFLWbY+fbtHSgm/jDXMGUj13w+J1muhXVS5wkkmM5EQF9jaoz+3Y06RhUK mRRwn2MI4zkXG4kTsH4GgrfOmupk+qhPJ3TOHPJFO4+ClKR8Hzgy/TB++LFfYr+tDs6/ BF2Q== 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:in-reply-to :references; bh=Z2CtOy6KdQkaZanqPqxStSpV8o3G43Rg43XLi2pvEZc=; b=t44iq5hFylqnhTwNOgIm/puQOvxiHiKxVGT8cyE3NP8oOVkaUhiZm2ApXpFpKti1Hz Ax88YOwpL2NCUEg4MyKAlhYTwSlOJ8I71MnYkMhxY8v3KDrqvYABfLe62Yxwxww8QYPy KaKSIyX4qiO4YXyuhT3K3qoITLSlcpECl/19qUXDzAPQaF1PAmrj84fzI62cvMRxtSsw Tbv9cuI5+uLc6C0MaGToIULSncgGtXH7rHNrHsJbup8513bZgNjO0qIP0JFYJ3bO08TD pGYoyCh+TlAUPMFTQtq4kP3iCtVNqFSssaYW/j4sippKfy2G5oAzm4vPRyFNh6zcbKtv AKag== X-Gm-Message-State: AOUpUlG7Il+cJIUEVrklMkxtxvA47nXG3UEBWIaL41ESzp1Q7+YpiixS vl56hpSaIc2XQT7Ex+zLSQmS3sQSjEM= X-Google-Smtp-Source: AAOMgpefQwtV5Go8bem2bY2ZBYg6SZwiXQ/F59aC/Gp0S77ZfKqRc33Y4TdPNcukzhPcEXL058aGXg== X-Received: by 2002:a65:58c8:: with SMTP id e8-v6mr15261766pgu.96.1533579080818; Mon, 06 Aug 2018 11:11:20 -0700 (PDT) Received: from xeon-e3.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id q78-v6sm23388130pfi.185.2018.08.06.11.11.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Aug 2018 11:11:19 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Mon, 6 Aug 2018 11:11:08 -0700 Message-Id: <20180806181108.5913-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180806181108.5913-1-stephen@networkplumber.org> References: <20180806181108.5913-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 3/3] vmbus: handle eof on irq read 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: Mon, 06 Aug 2018 18:11:22 -0000 This function is not used by netvsc driver yet. Still the code should handle case where device driver returns zero (due to rescind). Coverity issue: 302871 Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Signed-off-by: Stephen Hemminger --- drivers/bus/vmbus/linux/vmbus_uio.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c index bc2c6235e6bc..856c6d66785d 100644 --- a/drivers/bus/vmbus/linux/vmbus_uio.c +++ b/drivers/bus/vmbus/linux/vmbus_uio.c @@ -39,11 +39,17 @@ void vmbus_uio_irq_control(struct rte_vmbus_device *dev, int32_t onoff) int vmbus_uio_irq_read(struct rte_vmbus_device *dev) { int32_t count; - - if (read(dev->intr_handle.fd, &count, sizeof(count)) < 0) { - VMBUS_LOG(ERR, "cannot read to %d:%s", - dev->intr_handle.fd, strerror(errno)); - count = -errno; + int cc; + + cc = read(dev->intr_handle.fd, &count, sizeof(count)); + if (cc < (int)sizeof(count)) { + if (cc < 0) { + VMBUS_LOG(ERR, "IRQ read failed %s", + strerror(errno)); + return -errno; + } + VMBUS_LOG(ERR, "can't read IRQ count"); + return -EINVAL; } return count; -- 2.18.0