lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <723574d9-3c43-987e-9638-6d8ff58b1809@quicinc.com>
Date:   Thu, 25 May 2023 17:17:24 +0530
From:   Vikash Garodia <quic_vgarodia@...cinc.com>
To:     "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Stanimir Varbanov <stanimir.k.varbanov@...il.com>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <andersson@...nel.org>,
        Konrad Dybcio <konrad.dybcio@...aro.org>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        <linux-media@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <linux-hardening@...r.kernel.org>
Subject: Re: [PATCH 1/2][next] media: venus: hfi_cmds: Replace one-element
 array with flexible-array member



On 5/17/2023 4:44 AM, Gustavo A. R. Silva wrote:
> One-element arrays are deprecated, and we are replacing them with flexible
> array members instead. So, replace one-element arrays with flexible-array
> members in struct hfi_session_set_buffers_pkt, and refactor the rest of
> the code, accordingly.
> 
> This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
> routines on memcpy() and help us make progress towards globally
> enabling -fstrict-flex-arrays=3 [1].
> 
> This results in no differences in binary output.
> 
> Link: https://github.com/KSPP/linux/issues/79
> Link: https://github.com/KSPP/linux/issues/292
> Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>

The patch looks good. As stated in previous patch, lets combine this into a
single series.

> ---
>  drivers/media/platform/qcom/venus/hfi_cmds.c | 12 ++++++------
>  drivers/media/platform/qcom/venus/hfi_cmds.h |  2 +-
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c
> index bc3f8ff05840..21d1b3c90dc0 100644
> --- a/drivers/media/platform/qcom/venus/hfi_cmds.c
> +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c
> @@ -200,8 +200,8 @@ int pkt_session_set_buffers(struct hfi_session_set_buffers_pkt *pkt,
>  		struct hfi_buffer_info *bi;
>  
>  		pkt->extradata_size = bd->extradata_size;
> -		pkt->shdr.hdr.size = sizeof(*pkt) - sizeof(u32) +
> -			(bd->num_buffers * sizeof(*bi));
> +		pkt->shdr.hdr.size = sizeof(*pkt) +
> +			bd->num_buffers * sizeof(*bi);
>  		bi = (struct hfi_buffer_info *)pkt->buffer_info;
>  		for (i = 0; i < pkt->num_buffers; i++) {
>  			bi->buffer_addr = bd->device_addr;
> @@ -210,7 +210,7 @@ int pkt_session_set_buffers(struct hfi_session_set_buffers_pkt *pkt,
>  	} else {
>  		pkt->extradata_size = 0;
>  		pkt->shdr.hdr.size = sizeof(*pkt) +
> -			((bd->num_buffers - 1) * sizeof(u32));
> +			bd->num_buffers * sizeof(u32);
>  		for (i = 0; i < pkt->num_buffers; i++)
>  			pkt->buffer_info[i] = bd->device_addr;
>  	}
> @@ -243,8 +243,8 @@ int pkt_session_unset_buffers(struct hfi_session_release_buffer_pkt *pkt,
>  			bi->extradata_addr = bd->extradata_addr;
>  		}
>  		pkt->shdr.hdr.size =
> -				sizeof(struct hfi_session_set_buffers_pkt) -
> -				sizeof(u32) + (bd->num_buffers * sizeof(*bi));
> +				sizeof(struct hfi_session_set_buffers_pkt) +
> +				bd->num_buffers * sizeof(*bi);
>  	} else {
>  		for (i = 0; i < pkt->num_buffers; i++)
>  			pkt->buffer_info[i] = bd->device_addr;
> @@ -252,7 +252,7 @@ int pkt_session_unset_buffers(struct hfi_session_release_buffer_pkt *pkt,
>  		pkt->extradata_size = 0;
>  		pkt->shdr.hdr.size =
>  				sizeof(struct hfi_session_set_buffers_pkt) +
> -				((bd->num_buffers - 1) * sizeof(u32));
> +				bd->num_buffers * sizeof(u32);
>  	}
>  
>  	pkt->response_req = bd->response_required;
> diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h
> index 99bc0b6db67c..ba74d03eb9cd 100644
> --- a/drivers/media/platform/qcom/venus/hfi_cmds.h
> +++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
> @@ -117,7 +117,7 @@ struct hfi_session_set_buffers_pkt {
>  	u32 extradata_size;
>  	u32 min_buffer_size;
>  	u32 num_buffers;
> -	u32 buffer_info[1];
> +	u32 buffer_info[];
>  };
>  
>  struct hfi_session_get_sequence_header_pkt {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ