From 99ffd10ad27caaba5995b9b667b53982c3502418 Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Sun, 23 Oct 2005 22:32:47 +0000 Subject: [PATCH] Fix buffer size computation in ibv_cmd_get_context_v2() Correct silly mistake in ibv_cmd_get_context_v2() computation of size of buffer for old ABI command: we need to use sizeof *cmd instead of sizeof cmd, since cmd is a pointer. Signed-off-by: Roland Dreier --- ChangeLog | 6 ++++++ src/cmd.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3892019..3f47166 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-10-23 Roland Dreier + + * src/cmd.c (ibv_cmd_get_context_v2): Correct silly mistake in + computation of size of buffer for old ABI command: we need to use + sizeof *cmd instead of sizeof cmd, since cmd is a pointer. + 2005-10-21 Roland Dreier * src/cmd.c (ibv_cmd_post_send, ibv_cmd_post_recv, diff --git a/src/cmd.c b/src/cmd.c index 08cea2b..ce7ffef 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -60,7 +60,7 @@ static int ibv_cmd_get_context_v2(struct ibv_context *context, return ENOMEM; pthread_mutex_init(&t->in_use, NULL); - cmd_size = sizeof cmd + new_cmd_size - sizeof *new_cmd; + cmd_size = sizeof *cmd + new_cmd_size - sizeof *new_cmd; cmd = alloca(cmd_size); memcpy(cmd->driver_data, new_cmd->driver_data, new_cmd_size - sizeof *new_cmd); -- 2.41.0