Re: [PATCH rdma-core] mlx5: Fix device context allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/27/2017 3:43 PM, Yishai Hadas wrote:
From: Artemy Kovalyov <artemyko@xxxxxxxxxxxx>

Use calloc to allocate device context so the unset bytes are zero.
When building a *non* release mode (i.e. without DCMAKE_BUILD_TYPE=Release)
the below assert is applicable and might raise:
assert(dev->_ops._dummy1).

Fix below commit to use calloc instead of malloc for mlx5 as well.

Fixes: 85c449528709 ("providers: Make every provider allocate a
verbs_device")
Signed-off-by: Artemy Kovalyov <artemyko@xxxxxxxxxxxx>
Reviewed-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
---

Pull request was sent:
https://github.com/linux-rdma/rdma-core/pull/109

 providers/mlx5/mlx5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c
index edb6d35..30f165b 100644
--- a/providers/mlx5/mlx5.c
+++ b/providers/mlx5/mlx5.c
@@ -1006,7 +1006,7 @@ found:
 		return NULL;
 	}

-	dev = malloc(sizeof *dev);
+	dev = calloc(1, sizeof *dev);
 	if (!dev) {
 		fprintf(stderr, PFX "Fatal: couldn't allocate device for %s\n",
 			uverbs_sys_path);


Merged.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux