Skip to content

media: iris: Cast iris_hfi_gen2_get_instance() allocation type#56

Merged
dikshita-agarwal merged 1 commit intovideo.upstreamfrom
video.upstream.stage
Jan 14, 2026
Merged

media: iris: Cast iris_hfi_gen2_get_instance() allocation type#56
dikshita-agarwal merged 1 commit intovideo.upstreamfrom
video.upstream.stage

Conversation

@dikshita-agarwal
Copy link
Contributor

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 iris_inst *", but the returned type is "struct iris_inst_hfi_gen2 *". The allocation is intentionally larger as the first member of struct iris_inst_hfi_gen2 is struct iris_inst, so this is by design. Cast the allocation type to match the assignment.

Link: https://patch.msgid.link/20250426061526.work.106-kees@kernel.org

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 iris_inst *", but the returned type is
"struct iris_inst_hfi_gen2 *". The allocation is intentionally larger as
the first member of struct iris_inst_hfi_gen2 is struct iris_inst, so
this is by design. Cast the allocation type to match the assignment.

Link: https://patch.msgid.link/20250426061526.work.106-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
@dikshita-agarwal dikshita-agarwal merged commit 8cbece7 into video.upstream Jan 14, 2026
19 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants