* [PATCH] mlx5: vdpa: fix possible uninitialized var
@ 2021-01-08 8:24 ` Jason Wang
0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-01-08 8:24 UTC (permalink / raw)
To: mst, jasowang; +Cc: elic, virtualization, linux-kernel
Upstream: posted
When compiling with -Werror=maybe-uninitialized, gcc may complains the
possible uninitialized umem. Fix that.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index f1d54814db97..a6ad83d8d8e2 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -706,6 +706,9 @@ static void umem_destroy(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
case 3:
umem = &mvq->umem3;
break;
+ default:
+ WARN(1, "unsupported umem num %d\n", num);
+ return;
}
MLX5_SET(destroy_umem_in, in, opcode, MLX5_CMD_OP_DESTROY_UMEM);
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] mlx5: vdpa: fix possible uninitialized var
@ 2021-01-08 8:24 ` Jason Wang
0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-01-08 8:24 UTC (permalink / raw)
To: mst, jasowang; +Cc: elic, linux-kernel, virtualization
Upstream: posted
When compiling with -Werror=maybe-uninitialized, gcc may complains the
possible uninitialized umem. Fix that.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index f1d54814db97..a6ad83d8d8e2 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -706,6 +706,9 @@ static void umem_destroy(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
case 3:
umem = &mvq->umem3;
break;
+ default:
+ WARN(1, "unsupported umem num %d\n", num);
+ return;
}
MLX5_SET(destroy_umem_in, in, opcode, MLX5_CMD_OP_DESTROY_UMEM);
--
2.25.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mlx5: vdpa: fix possible uninitialized var
2021-01-08 8:24 ` Jason Wang
(?)
@ 2021-01-10 6:39 ` Eli Cohen
2021-01-12 2:53 ` Jason Wang
-1 siblings, 1 reply; 5+ messages in thread
From: Eli Cohen @ 2021-01-10 6:39 UTC (permalink / raw)
To: Jason Wang; +Cc: mst, virtualization, linux-kernel
On Fri, Jan 08, 2021 at 04:24:43PM +0800, Jason Wang wrote:
> Upstream: posted
>
> When compiling with -Werror=maybe-uninitialized, gcc may complains the
> possible uninitialized umem. Fix that.
>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index f1d54814db97..a6ad83d8d8e2 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -706,6 +706,9 @@ static void umem_destroy(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
> case 3:
> umem = &mvq->umem3;
> break;
> + default:
> + WARN(1, "unsupported umem num %d\n", num);
> + return;
> }
>
> MLX5_SET(destroy_umem_in, in, opcode, MLX5_CMD_OP_DESTROY_UMEM);
Since the "default" case will never be executed, maybe it's better to
just change "case 3:" to "default:" and avoid the WARN().
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mlx5: vdpa: fix possible uninitialized var
2021-01-10 6:39 ` Eli Cohen
@ 2021-01-12 2:53 ` Jason Wang
0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-01-12 2:53 UTC (permalink / raw)
To: Eli Cohen; +Cc: mst, virtualization, linux-kernel
On 2021/1/10 下午2:39, Eli Cohen wrote:
> On Fri, Jan 08, 2021 at 04:24:43PM +0800, Jason Wang wrote:
>> Upstream: posted
>>
>> When compiling with -Werror=maybe-uninitialized, gcc may complains the
>> possible uninitialized umem. Fix that.
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> index f1d54814db97..a6ad83d8d8e2 100644
>> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> @@ -706,6 +706,9 @@ static void umem_destroy(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
>> case 3:
>> umem = &mvq->umem3;
>> break;
>> + default:
>> + WARN(1, "unsupported umem num %d\n", num);
>> + return;
>> }
>>
>> MLX5_SET(destroy_umem_in, in, opcode, MLX5_CMD_OP_DESTROY_UMEM);
> Since the "default" case will never be executed, maybe it's better to
> just change "case 3:" to "default:" and avoid the WARN().
Fine with me. Will do that in V3.
Thanks
>
>> --
>> 2.25.1
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mlx5: vdpa: fix possible uninitialized var
@ 2021-01-12 2:53 ` Jason Wang
0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-01-12 2:53 UTC (permalink / raw)
To: Eli Cohen; +Cc: virtualization, linux-kernel, mst
On 2021/1/10 下午2:39, Eli Cohen wrote:
> On Fri, Jan 08, 2021 at 04:24:43PM +0800, Jason Wang wrote:
>> Upstream: posted
>>
>> When compiling with -Werror=maybe-uninitialized, gcc may complains the
>> possible uninitialized umem. Fix that.
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> index f1d54814db97..a6ad83d8d8e2 100644
>> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>> @@ -706,6 +706,9 @@ static void umem_destroy(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
>> case 3:
>> umem = &mvq->umem3;
>> break;
>> + default:
>> + WARN(1, "unsupported umem num %d\n", num);
>> + return;
>> }
>>
>> MLX5_SET(destroy_umem_in, in, opcode, MLX5_CMD_OP_DESTROY_UMEM);
> Since the "default" case will never be executed, maybe it's better to
> just change "case 3:" to "default:" and avoid the WARN().
Fine with me. Will do that in V3.
Thanks
>
>> --
>> 2.25.1
>>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-12 2:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 8:24 [PATCH] mlx5: vdpa: fix possible uninitialized var Jason Wang
2021-01-08 8:24 ` Jason Wang
2021-01-10 6:39 ` Eli Cohen
2021-01-12 2:53 ` Jason Wang
2021-01-12 2:53 ` Jason Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.