diff options
| author | Kees Cook <kees@kernel.org> | 2025-04-25 23:15:27 -0700 |
|---|---|---|
| committer | Kees Cook <kees@kernel.org> | 2025-11-24 12:44:05 -0800 |
| commit | fbcc2150aa40655451c28b1a8d750f8468f3b092 (patch) | |
| tree | 1ab31e7d5b44307e3ef5f2c8ed23028998717d5f | |
| parent | 961c989c5fbbd9146d5cb134d3f663c20708b2be (diff) | |
media: iris: Cast iris_hfi_gen2_get_instance() 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 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>
| -rw-r--r-- | drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c index 4ce71a142508..a93da457544a 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c @@ -1195,5 +1195,5 @@ void iris_hfi_gen2_command_ops_init(struct iris_core *core) struct iris_inst *iris_hfi_gen2_get_instance(void) { - return kzalloc(sizeof(struct iris_inst_hfi_gen2), GFP_KERNEL); + return (struct iris_inst *)kzalloc(sizeof(struct iris_inst_hfi_gen2), GFP_KERNEL); } |