From: Mohammed EL Kadiri <med08elkadiri@gmail.com>
To: quic_vgarodia@quicinc.com, quic_dikshita@quicinc.com
Cc: bryan.odonoghue@linaro.org, mchehab@kernel.org,
gustavoars@kernel.org, kees@kernel.org,
linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
Mohammed EL Kadiri <med08elkadiri@gmail.com>
Subject: [PATCH] media: venus: Annotate flex arrays with __counted_by()
Date: Mon, 11 May 2026 14:05:38 +0100 [thread overview]
Message-ID: <20260511130538.33443-1-med08elkadiri@gmail.com> (raw)
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().
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
next reply other threads:[~2026-05-11 13:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 13:05 Mohammed EL Kadiri [this message]
2026-05-11 17:57 ` [PATCH] media: venus: Annotate flex arrays with __counted_by() Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260511130538.33443-1-med08elkadiri@gmail.com \
--to=med08elkadiri@gmail.com \
--cc=bryan.odonoghue@linaro.org \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=quic_dikshita@quicinc.com \
--cc=quic_vgarodia@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox