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

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

 



From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>

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@xxxxxxxxxxxx>
---
 libibverbs/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

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