* [PATCH] vdpa/mlx5: Fix uninitialised variable in core/mr.c
@ 2020-08-06 18:56 Alex Dewar
2020-08-07 3:54 ` Jason Wang
2020-08-09 5:50 ` Eli Cohen
0 siblings, 2 replies; 4+ messages in thread
From: Alex Dewar @ 2020-08-06 18:56 UTC (permalink / raw
To: Michael S. Tsirkin, Jason Wang, Parav Pandit, Eli Cohen,
Alex Dewar, virtualization, linux-kernel
If the kernel is unable to allocate memory for the variable dmr then
err will be returned without being set. Set err to -ENOMEM in this
case.
Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
Addresses-Coverity: ("Uninitialized variables")
Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
---
drivers/vdpa/mlx5/core/mr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
index f5dec0274133..ef1c550f8266 100644
--- a/drivers/vdpa/mlx5/core/mr.c
+++ b/drivers/vdpa/mlx5/core/mr.c
@@ -319,8 +319,10 @@ static int add_direct_chain(struct mlx5_vdpa_dev *mvdev, u64 start, u64 size, u8
while (size) {
sz = (u32)min_t(u64, MAX_KLM_SIZE, size);
dmr = kzalloc(sizeof(*dmr), GFP_KERNEL);
- if (!dmr)
+ if (!dmr) {
+ err = -ENOMEM;
goto err_alloc;
+ }
dmr->start = st;
dmr->end = st + sz;
--
2.28.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] vdpa/mlx5: Fix uninitialised variable in core/mr.c
2020-08-06 18:56 [PATCH] vdpa/mlx5: Fix uninitialised variable in core/mr.c Alex Dewar
@ 2020-08-07 3:54 ` Jason Wang
2020-08-09 5:50 ` Eli Cohen
1 sibling, 0 replies; 4+ messages in thread
From: Jason Wang @ 2020-08-07 3:54 UTC (permalink / raw
To: Alex Dewar, Michael S. Tsirkin, Parav Pandit, Eli Cohen,
virtualization, linux-kernel
On 2020/8/7 上午2:56, Alex Dewar wrote:
> If the kernel is unable to allocate memory for the variable dmr then
> err will be returned without being set. Set err to -ENOMEM in this
> case.
>
> Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
> Addresses-Coverity: ("Uninitialized variables")
> Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/vdpa/mlx5/core/mr.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
> index f5dec0274133..ef1c550f8266 100644
> --- a/drivers/vdpa/mlx5/core/mr.c
> +++ b/drivers/vdpa/mlx5/core/mr.c
> @@ -319,8 +319,10 @@ static int add_direct_chain(struct mlx5_vdpa_dev *mvdev, u64 start, u64 size, u8
> while (size) {
> sz = (u32)min_t(u64, MAX_KLM_SIZE, size);
> dmr = kzalloc(sizeof(*dmr), GFP_KERNEL);
> - if (!dmr)
> + if (!dmr) {
> + err = -ENOMEM;
> goto err_alloc;
> + }
>
> dmr->start = st;
> dmr->end = st + sz;
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vdpa/mlx5: Fix uninitialised variable in core/mr.c
@ 2020-08-07 3:54 ` Jason Wang
0 siblings, 0 replies; 4+ messages in thread
From: Jason Wang @ 2020-08-07 3:54 UTC (permalink / raw
To: Alex Dewar, Michael S. Tsirkin, Parav Pandit, Eli Cohen,
virtualization, linux-kernel
On 2020/8/7 上午2:56, Alex Dewar wrote:
> If the kernel is unable to allocate memory for the variable dmr then
> err will be returned without being set. Set err to -ENOMEM in this
> case.
>
> Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
> Addresses-Coverity: ("Uninitialized variables")
> Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/vdpa/mlx5/core/mr.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
> index f5dec0274133..ef1c550f8266 100644
> --- a/drivers/vdpa/mlx5/core/mr.c
> +++ b/drivers/vdpa/mlx5/core/mr.c
> @@ -319,8 +319,10 @@ static int add_direct_chain(struct mlx5_vdpa_dev *mvdev, u64 start, u64 size, u8
> while (size) {
> sz = (u32)min_t(u64, MAX_KLM_SIZE, size);
> dmr = kzalloc(sizeof(*dmr), GFP_KERNEL);
> - if (!dmr)
> + if (!dmr) {
> + err = -ENOMEM;
> goto err_alloc;
> + }
>
> dmr->start = st;
> dmr->end = st + sz;
> --
> 2.28.0
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vdpa/mlx5: Fix uninitialised variable in core/mr.c
2020-08-06 18:56 [PATCH] vdpa/mlx5: Fix uninitialised variable in core/mr.c Alex Dewar
2020-08-07 3:54 ` Jason Wang
@ 2020-08-09 5:50 ` Eli Cohen
1 sibling, 0 replies; 4+ messages in thread
From: Eli Cohen @ 2020-08-09 5:50 UTC (permalink / raw
To: Alex Dewar
Cc: Michael S. Tsirkin, Jason Wang, Parav Pandit, virtualization,
linux-kernel
On Thu, Aug 06, 2020 at 07:56:15PM +0100, Alex Dewar wrote:
Acked-by: Eli Cohen <eli@mellanox.com>
> If the kernel is unable to allocate memory for the variable dmr then
> err will be returned without being set. Set err to -ENOMEM in this
> case.
>
> Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
> Addresses-Coverity: ("Uninitialized variables")
> Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
> ---
> drivers/vdpa/mlx5/core/mr.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
> index f5dec0274133..ef1c550f8266 100644
> --- a/drivers/vdpa/mlx5/core/mr.c
> +++ b/drivers/vdpa/mlx5/core/mr.c
> @@ -319,8 +319,10 @@ static int add_direct_chain(struct mlx5_vdpa_dev *mvdev, u64 start, u64 size, u8
> while (size) {
> sz = (u32)min_t(u64, MAX_KLM_SIZE, size);
> dmr = kzalloc(sizeof(*dmr), GFP_KERNEL);
> - if (!dmr)
> + if (!dmr) {
> + err = -ENOMEM;
> goto err_alloc;
> + }
>
> dmr->start = st;
> dmr->end = st + sz;
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-09 5:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-06 18:56 [PATCH] vdpa/mlx5: Fix uninitialised variable in core/mr.c Alex Dewar
2020-08-07 3:54 ` Jason Wang
2020-08-07 3:54 ` Jason Wang
2020-08-09 5:50 ` Eli Cohen
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.