Skip to content

Commit

Permalink
media: hfi_parser: don't trick gcc with a wrong expected size
Browse files Browse the repository at this point in the history
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 <mchehab+samsung@kernel.org>
  • Loading branch information
mchehab committed Mar 25, 2019
1 parent bf78f23 commit ded7162
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/platform/qcom/venus/hfi_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ struct hfi_capability {

struct hfi_capabilities {
u32 num_capabilities;
struct hfi_capability data[1];
struct hfi_capability *data;
};

#define HFI_DEBUG_MSG_LOW 0x01
Expand Down Expand Up @@ -726,7 +726,7 @@ struct hfi_profile_level {

struct hfi_profile_level_supported {
u32 profile_count;
struct hfi_profile_level profile_level[1];
struct hfi_profile_level *profile_level;
};

struct hfi_quality_vs_speed {
Expand Down

0 comments on commit ded7162

Please sign in to comment.