diff mbox

[rdma-core,1/6] verbs: Fix size of verbs_ex_private allocation

Message ID 20180218204002.7408-2-jgg@ziepe.ca (mailing list archive)
State Accepted
Headers show

Commit Message

Jason Gunthorpe Feb. 18, 2018, 8:39 p.m. UTC
From: Jason Gunthorpe <jgg@mellanox.com>

Missing '*' causes the size to be wrong if the struct is expanded.
It works as-is today because the struct contains exactly one pointer
so sizeof(struct verbs_ex_prviate *) == sizeof(struct verbs_ex_private)

Fixes: 1111cf9895bb ("verbs: Always allocate a verbs_context")
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 libibverbs/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libibverbs/device.c b/libibverbs/device.c
index 682a504f863802..8b97dde779e0ba 100644
--- a/libibverbs/device.c
+++ b/libibverbs/device.c
@@ -217,7 +217,7 @@  int verbs_init_context(struct verbs_context *context_ex,
 	context_ex->ABI_placeholder2 =
 		(void (*)(void))context_ex->ibv_destroy_flow;
 
-	context_ex->priv = calloc(1, sizeof(context_ex->priv));
+	context_ex->priv = calloc(1, sizeof(*context_ex->priv));
 	if (!context_ex->priv) {
 		errno = ENOMEM;
 		close(cmd_fd);