Skip to content

Commit ded7162

Browse files
committed
media: hfi_parser: don't trick gcc with a wrong expected size
Smatch warns about small size on two structs: drivers/media/platform/qcom/venus/hfi_parser.c:103 parse_profile_level() error: memcpy() 'proflevel' too small (8 vs 128) drivers/media/platform/qcom/venus/hfi_parser.c: drivers/media/platform/qcom/venus/hfi_parser.c:129 parse_caps() error: memcpy() 'cap' too small (16 vs 512) The reason is that the hfi_parser actually expects: - multiple data entries on hfi_capabilities - multiple profile_level on hfi_profile_level_supported However, the structs trick gcc, making it to believe that there's just one value for each. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent bf78f23 commit ded7162

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/media/platform/qcom/venus/hfi_helper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ struct hfi_capability {
569569

570570
struct hfi_capabilities {
571571
u32 num_capabilities;
572-
struct hfi_capability data[1];
572+
struct hfi_capability *data;
573573
};
574574

575575
#define HFI_DEBUG_MSG_LOW 0x01
@@ -726,7 +726,7 @@ struct hfi_profile_level {
726726

727727
struct hfi_profile_level_supported {
728728
u32 profile_count;
729-
struct hfi_profile_level profile_level[1];
729+
struct hfi_profile_level *profile_level;
730730
};
731731

732732
struct hfi_quality_vs_speed {

0 commit comments

Comments
 (0)