Skip to content

Commit 3db60cf

Browse files
keesrleon
authored andcommitted
IB/hfi1: Adjust fd->entry_to_rb 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 "struct tid_rb_node **", but the return type will be "struct rb_node **". 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 7c04bc9 commit 3db60cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/hfi1/user_exp_rcv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int hfi1_user_exp_rcv_init(struct hfi1_filedata *fd,
5353
int ret = 0;
5454

5555
fd->entry_to_rb = kcalloc(uctxt->expected_count,
56-
sizeof(struct rb_node *),
56+
sizeof(*fd->entry_to_rb),
5757
GFP_KERNEL);
5858
if (!fd->entry_to_rb)
5959
return -ENOMEM;

0 commit comments

Comments
 (0)