* [PATCH v2] media: venus: Annotate flex arrays with __counted_by()
@ 2026-06-07 11:19 Mohammed EL Kadiri
2026-06-08 8:01 ` Konrad Dybcio
0 siblings, 1 reply; 2+ messages in thread
From: Mohammed EL Kadiri @ 2026-06-07 11:19 UTC (permalink / raw)
To: quic_vgarodia, quic_dikshita, bryan.odonoghue, mchehab
Cc: kees, gustavoars, dmitry.baryshkov, linux-media, linux-arm-msm,
linux-hardening, linux-kernel, Mohammed EL Kadiri
Add __counted_by() annotations to flexible array members:
- hfi_capabilities::data, counted by num_capabilities
- hfi_profile_level_supported::profile_level, counted by profile_count
- hfi_resource_ocmem_requirement_info::requirements, counted by num_entries
This improves run-time bounds checking via CONFIG_UBSAN_BOUNDS and
compile-time object size resolution via __builtin_dynamic_object_size().
Assisted-by: Claude:claude-opus-4
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Mohammed EL Kadiri <med08elkadiri@gmail.com>
---
drivers/media/platform/qcom/venus/hfi_helper.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h
index f44059f19505..e96d458c52fa 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -616,7 +616,7 @@ struct hfi_capability {
struct hfi_capabilities {
u32 num_capabilities;
- struct hfi_capability data[];
+ struct hfi_capability data[] __counted_by(num_capabilities);
};
#define HFI_DEBUG_MSG_LOW 0x01
@@ -802,7 +802,7 @@ struct hfi_profile_level {
struct hfi_profile_level_supported {
u32 profile_count;
- struct hfi_profile_level profile_level[];
+ struct hfi_profile_level profile_level[] __counted_by(profile_count);
};
struct hfi_quality_vs_speed {
@@ -1085,7 +1085,7 @@ struct hfi_resource_ocmem_requirement {
struct hfi_resource_ocmem_requirement_info {
u32 num_entries;
- struct hfi_resource_ocmem_requirement requirements[];
+ struct hfi_resource_ocmem_requirement requirements[] __counted_by(num_entries);
};
struct hfi_property_sys_image_version_info_type {
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] media: venus: Annotate flex arrays with __counted_by()
2026-06-07 11:19 [PATCH v2] media: venus: Annotate flex arrays with __counted_by() Mohammed EL Kadiri
@ 2026-06-08 8:01 ` Konrad Dybcio
0 siblings, 0 replies; 2+ messages in thread
From: Konrad Dybcio @ 2026-06-08 8:01 UTC (permalink / raw)
To: Mohammed EL Kadiri, quic_vgarodia, quic_dikshita,
bryan.odonoghue, mchehab
Cc: kees, gustavoars, dmitry.baryshkov, linux-media, linux-arm-msm,
linux-hardening, linux-kernel
On 6/7/26 1:19 PM, Mohammed EL Kadiri wrote:
> Add __counted_by() annotations to flexible array members:
>
> - hfi_capabilities::data, counted by num_capabilities
> - hfi_profile_level_supported::profile_level, counted by profile_count
> - hfi_resource_ocmem_requirement_info::requirements, counted by num_entries
>
> This improves run-time bounds checking via CONFIG_UBSAN_BOUNDS and
> compile-time object size resolution via __builtin_dynamic_object_size().
>
> Assisted-by: Claude:claude-opus-4
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Signed-off-by: Mohammed EL Kadiri <med08elkadiri@gmail.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-08 8:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-07 11:19 [PATCH v2] media: venus: Annotate flex arrays with __counted_by() Mohammed EL Kadiri
2026-06-08 8:01 ` Konrad Dybcio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome