media: venus: Annotate flex arrays with __counted_by()

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>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
This commit is contained in:
Mohammed EL Kadiri 2026-06-07 12:19:33 +01:00 committed by Bryan O'Donoghue
parent b9c2215bde
commit 4bf9ae6229

View File

@ -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 {