DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] Fix Coverity issues for virtio-pci and vhost-user msg
@ 2018-11-07  9:01 Tiwei Bie
  2018-11-07  9:01 ` [dpdk-dev] [PATCH 1/2] net/virtio: fix unchecked return value Tiwei Bie
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tiwei Bie @ 2018-11-07  9:01 UTC (permalink / raw)
  To: maxime.coquelin, zhihong.wang, dev

Tiwei Bie (2):
  net/virtio: fix unchecked return value
  vhost: remove unneeded null pointer check

 drivers/net/virtio/virtio_pci.c | 10 ++++++++--
 lib/librte_vhost/vhost_user.c   |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

-- 
2.19.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 1/2] net/virtio: fix unchecked return value
  2018-11-07  9:01 [dpdk-dev] [PATCH 0/2] Fix Coverity issues for virtio-pci and vhost-user msg Tiwei Bie
@ 2018-11-07  9:01 ` Tiwei Bie
  2018-11-09 11:38   ` Maxime Coquelin
  2018-11-07  9:01 ` [dpdk-dev] [PATCH 2/2] vhost: remove unneeded null pointer check Tiwei Bie
  2018-11-09 14:52 ` [dpdk-dev] [PATCH 0/2] Fix Coverity issues for virtio-pci and vhost-user msg Maxime Coquelin
  2 siblings, 1 reply; 6+ messages in thread
From: Tiwei Bie @ 2018-11-07  9:01 UTC (permalink / raw)
  To: maxime.coquelin, zhihong.wang, dev

Coverity issue: 302861
Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
This patch can't be backported because it depends on the
API change introduced by below commit in this release.

commit e8d435f1f3a1 ("bus/pci: harmonize return value of config read")

 drivers/net/virtio/virtio_pci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 21110cd69..c8883c32e 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -614,9 +614,15 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw)
 			hw->common_cfg = get_cfg_addr(dev, &cap);
 			break;
 		case VIRTIO_PCI_CAP_NOTIFY_CFG:
-			rte_pci_read_config(dev, &hw->notify_off_multiplier,
+			ret = rte_pci_read_config(dev,
+					&hw->notify_off_multiplier,
 					4, pos + sizeof(cap));
-			hw->notify_base = get_cfg_addr(dev, &cap);
+			if (ret != 4)
+				PMD_INIT_LOG(DEBUG,
+					"failed to read notify_off_multiplier, ret %d",
+					ret);
+			else
+				hw->notify_base = get_cfg_addr(dev, &cap);
 			break;
 		case VIRTIO_PCI_CAP_DEVICE_CFG:
 			hw->dev_cfg = get_cfg_addr(dev, &cap);
-- 
2.19.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 2/2] vhost: remove unneeded null pointer check
  2018-11-07  9:01 [dpdk-dev] [PATCH 0/2] Fix Coverity issues for virtio-pci and vhost-user msg Tiwei Bie
  2018-11-07  9:01 ` [dpdk-dev] [PATCH 1/2] net/virtio: fix unchecked return value Tiwei Bie
@ 2018-11-07  9:01 ` Tiwei Bie
  2018-11-09 11:38   ` Maxime Coquelin
  2018-11-09 14:52 ` [dpdk-dev] [PATCH 0/2] Fix Coverity issues for virtio-pci and vhost-user msg Maxime Coquelin
  2 siblings, 1 reply; 6+ messages in thread
From: Tiwei Bie @ 2018-11-07  9:01 UTC (permalink / raw)
  To: maxime.coquelin, zhihong.wang, dev; +Cc: stable

The caller will guarantee that msg won't be null. Remove
the unneeded null pointer check which caused a Coverity
warning.

Coverity issue: 323484
Fixes: 8f972312b8f4 ("vhost: support vhost-user")
Cc: stable@dpdk.org

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 lib/librte_vhost/vhost_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index cc154f312..3ea64eba6 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -1732,7 +1732,7 @@ read_vhost_message(int sockfd, struct VhostUserMsg *msg)
 	if (ret <= 0)
 		return ret;
 
-	if (msg && msg->size) {
+	if (msg->size) {
 		if (msg->size > sizeof(msg->payload)) {
 			RTE_LOG(ERR, VHOST_CONFIG,
 				"invalid msg size: %d\n", msg->size);
-- 
2.19.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] net/virtio: fix unchecked return value
  2018-11-07  9:01 ` [dpdk-dev] [PATCH 1/2] net/virtio: fix unchecked return value Tiwei Bie
@ 2018-11-09 11:38   ` Maxime Coquelin
  0 siblings, 0 replies; 6+ messages in thread
From: Maxime Coquelin @ 2018-11-09 11:38 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev



On 11/7/18 10:01 AM, Tiwei Bie wrote:
> Coverity issue: 302861
> Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
> This patch can't be backported because it depends on the
> API change introduced by below commit in this release.
> 
> commit e8d435f1f3a1 ("bus/pci: harmonize return value of config read")
> 
>   drivers/net/virtio/virtio_pci.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
> index 21110cd69..c8883c32e 100644
> --- a/drivers/net/virtio/virtio_pci.c
> +++ b/drivers/net/virtio/virtio_pci.c
> @@ -614,9 +614,15 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw)
>   			hw->common_cfg = get_cfg_addr(dev, &cap);
>   			break;
>   		case VIRTIO_PCI_CAP_NOTIFY_CFG:
> -			rte_pci_read_config(dev, &hw->notify_off_multiplier,
> +			ret = rte_pci_read_config(dev,
> +					&hw->notify_off_multiplier,
>   					4, pos + sizeof(cap));
> -			hw->notify_base = get_cfg_addr(dev, &cap);
> +			if (ret != 4)
> +				PMD_INIT_LOG(DEBUG,
> +					"failed to read notify_off_multiplier, ret %d",
> +					ret);
> +			else
> +				hw->notify_base = get_cfg_addr(dev, &cap);
>   			break;
>   		case VIRTIO_PCI_CAP_DEVICE_CFG:
>   			hw->dev_cfg = get_cfg_addr(dev, &cap);
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] vhost: remove unneeded null pointer check
  2018-11-07  9:01 ` [dpdk-dev] [PATCH 2/2] vhost: remove unneeded null pointer check Tiwei Bie
@ 2018-11-09 11:38   ` Maxime Coquelin
  0 siblings, 0 replies; 6+ messages in thread
From: Maxime Coquelin @ 2018-11-09 11:38 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev; +Cc: stable



On 11/7/18 10:01 AM, Tiwei Bie wrote:
> The caller will guarantee that msg won't be null. Remove
> the unneeded null pointer check which caused a Coverity
> warning.
> 
> Coverity issue: 323484
> Fixes: 8f972312b8f4 ("vhost: support vhost-user")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   lib/librte_vhost/vhost_user.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index cc154f312..3ea64eba6 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -1732,7 +1732,7 @@ read_vhost_message(int sockfd, struct VhostUserMsg *msg)
>   	if (ret <= 0)
>   		return ret;
>   
> -	if (msg && msg->size) {
> +	if (msg->size) {
>   		if (msg->size > sizeof(msg->payload)) {
>   			RTE_LOG(ERR, VHOST_CONFIG,
>   				"invalid msg size: %d\n", msg->size);
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] Fix Coverity issues for virtio-pci and vhost-user msg
  2018-11-07  9:01 [dpdk-dev] [PATCH 0/2] Fix Coverity issues for virtio-pci and vhost-user msg Tiwei Bie
  2018-11-07  9:01 ` [dpdk-dev] [PATCH 1/2] net/virtio: fix unchecked return value Tiwei Bie
  2018-11-07  9:01 ` [dpdk-dev] [PATCH 2/2] vhost: remove unneeded null pointer check Tiwei Bie
@ 2018-11-09 14:52 ` Maxime Coquelin
  2 siblings, 0 replies; 6+ messages in thread
From: Maxime Coquelin @ 2018-11-09 14:52 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev



On 11/7/18 10:01 AM, Tiwei Bie wrote:
> Tiwei Bie (2):
>    net/virtio: fix unchecked return value
>    vhost: remove unneeded null pointer check
> 
>   drivers/net/virtio/virtio_pci.c | 10 ++++++++--
>   lib/librte_vhost/vhost_user.c   |  2 +-
>   2 files changed, 9 insertions(+), 3 deletions(-)
> 


Applied to dpdk-next-virtio/master

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-09 14:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07  9:01 [dpdk-dev] [PATCH 0/2] Fix Coverity issues for virtio-pci and vhost-user msg Tiwei Bie
2018-11-07  9:01 ` [dpdk-dev] [PATCH 1/2] net/virtio: fix unchecked return value Tiwei Bie
2018-11-09 11:38   ` Maxime Coquelin
2018-11-07  9:01 ` [dpdk-dev] [PATCH 2/2] vhost: remove unneeded null pointer check Tiwei Bie
2018-11-09 11:38   ` Maxime Coquelin
2018-11-09 14:52 ` [dpdk-dev] [PATCH 0/2] Fix Coverity issues for virtio-pci and vhost-user msg Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).