Skip to content

Commit 7c04bc9

Browse files
keesrleon
authored andcommitted
IB/mthca: Adjust buddy->bits allocation type
In preparation for making the kmalloc family of allocators type aware, we need to make sure that the returned type from the allocation matches the type of the variable being assigned. (Before, the allocator would always return "void *", which can be implicitly cast to any pointer type.) The assigned type is "unsigned long **", but the returned type will be "long **". These are the same allocation size (pointer size), but the types do not match. Adjust the allocation type to match the assignment. Signed-off-by: Kees Cook <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 6bd18da commit 7c04bc9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/mthca/mthca_mr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static int mthca_buddy_init(struct mthca_buddy *buddy, int max_order)
144144
buddy->max_order = max_order;
145145
spin_lock_init(&buddy->lock);
146146

147-
buddy->bits = kcalloc(buddy->max_order + 1, sizeof(long *),
147+
buddy->bits = kcalloc(buddy->max_order + 1, sizeof(*buddy->bits),
148148
GFP_KERNEL);
149149
buddy->num_free = kcalloc((buddy->max_order + 1), sizeof *buddy->num_free,
150150
GFP_KERNEL);

0 commit comments

Comments
 (0)