media: venus: hfi_cmds: Fix packet size calculation
Now that a one-element array was replaced with a flexible-array member in struct hfi_sys_set_property_pkt, use the struct_size() helper to correctly calculate the packet size. Fixes: 701e10b3fd9f ("media: venus: hfi_cmds.h: Replace one-element array with flexible-array member") Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
1289169842
commit
c73c23f347
|
@ -3,6 +3,7 @@
|
|||
* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
* Copyright (C) 2017 Linaro Ltd.
|
||||
*/
|
||||
#include <linux/overflow.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/hash.h>
|
||||
|
||||
|
@ -27,7 +28,7 @@ void pkt_sys_idle_indicator(struct hfi_sys_set_property_pkt *pkt, u32 enable)
|
|||
{
|
||||
struct hfi_enable *hfi = (struct hfi_enable *)&pkt->data[1];
|
||||
|
||||
pkt->hdr.size = sizeof(*pkt) + sizeof(*hfi) + sizeof(u32);
|
||||
pkt->hdr.size = struct_size(pkt, data, 1) + sizeof(*hfi);
|
||||
pkt->hdr.pkt_type = HFI_CMD_SYS_SET_PROPERTY;
|
||||
pkt->num_properties = 1;
|
||||
pkt->data[0] = HFI_PROPERTY_SYS_IDLE_INDICATOR;
|
||||
|
@ -39,7 +40,7 @@ void pkt_sys_debug_config(struct hfi_sys_set_property_pkt *pkt, u32 mode,
|
|||
{
|
||||
struct hfi_debug_config *hfi;
|
||||
|
||||
pkt->hdr.size = sizeof(*pkt) + sizeof(*hfi) + sizeof(u32);
|
||||
pkt->hdr.size = struct_size(pkt, data, 1) + sizeof(*hfi);
|
||||
pkt->hdr.pkt_type = HFI_CMD_SYS_SET_PROPERTY;
|
||||
pkt->num_properties = 1;
|
||||
pkt->data[0] = HFI_PROPERTY_SYS_DEBUG_CONFIG;
|
||||
|
@ -50,7 +51,7 @@ void pkt_sys_debug_config(struct hfi_sys_set_property_pkt *pkt, u32 mode,
|
|||
|
||||
void pkt_sys_coverage_config(struct hfi_sys_set_property_pkt *pkt, u32 mode)
|
||||
{
|
||||
pkt->hdr.size = sizeof(*pkt) + sizeof(u32);
|
||||
pkt->hdr.size = struct_size(pkt, data, 2);
|
||||
pkt->hdr.pkt_type = HFI_CMD_SYS_SET_PROPERTY;
|
||||
pkt->num_properties = 1;
|
||||
pkt->data[0] = HFI_PROPERTY_SYS_CONFIG_COVERAGE;
|
||||
|
@ -116,7 +117,7 @@ void pkt_sys_power_control(struct hfi_sys_set_property_pkt *pkt, u32 enable)
|
|||
{
|
||||
struct hfi_enable *hfi = (struct hfi_enable *)&pkt->data[1];
|
||||
|
||||
pkt->hdr.size = sizeof(*pkt) + sizeof(*hfi) + sizeof(u32);
|
||||
pkt->hdr.size = struct_size(pkt, data, 1) + sizeof(*hfi);
|
||||
pkt->hdr.pkt_type = HFI_CMD_SYS_SET_PROPERTY;
|
||||
pkt->num_properties = 1;
|
||||
pkt->data[0] = HFI_PROPERTY_SYS_CODEC_POWER_PLANE_CTRL;
|
||||
|
|
Loading…
Reference in New Issue