diff mbox series

[2/2] vhost: remove unneeded null pointer check

Message ID 20181107090102.9364-3-tiwei.bie@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers show
Series Fix Coverity issues for virtio-pci and vhost-user msg | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Tiwei Bie Nov. 7, 2018, 9:01 a.m. UTC
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(-)

Comments

Maxime Coquelin Nov. 9, 2018, 11:38 a.m. UTC | #1
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
diff mbox series

Patch

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);