diff mbox series

[next] media: venus: Use struct_size_t() helper in pkt_session_unset_buffers()

Message ID ZKBfoqSl61jfpO2r@work (mailing list archive)
State Not Applicable
Headers show
Series [next] media: venus: Use struct_size_t() helper in pkt_session_unset_buffers() | expand

Commit Message

Gustavo A. R. Silva July 1, 2023, 5:17 p.m. UTC
Prefer struct_size_t() over struct_size() when no pointer instance
of the structure type is present.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/media/platform/qcom/venus/hfi_cmds.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Vikash Garodia July 10, 2023, 7:10 a.m. UTC | #1
On 7/1/2023 10:47 PM, Gustavo A. R. Silva wrote:
> Prefer struct_size_t() over struct_size() when no pointer instance
> of the structure type is present.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>

> ---
>  drivers/media/platform/qcom/venus/hfi_cmds.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c
> index 7f0802a5518c..3418d2dd9371 100644
> --- a/drivers/media/platform/qcom/venus/hfi_cmds.c
> +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c
> @@ -251,8 +251,8 @@ int pkt_session_unset_buffers(struct hfi_session_release_buffer_pkt *pkt,
>  
>  		pkt->extradata_size = 0;
>  		pkt->shdr.hdr.size =
> -			struct_size((struct hfi_session_set_buffers_pkt *)0,
> -				    buffer_info, bd->num_buffers);
> +			struct_size_t(struct hfi_session_set_buffers_pkt,
> +				      buffer_info, bd->num_buffers);
>  	}
>  
>  	pkt->response_req = bd->response_required;
Kees Cook July 27, 2023, 5:11 p.m. UTC | #2
On Sat, 01 Jul 2023 11:17:22 -0600, Gustavo A. R. Silva wrote:
> Prefer struct_size_t() over struct_size() when no pointer instance
> of the structure type is present.

Applied to for-linus/hardening, thanks!

[1/1] media: venus: Use struct_size_t() helper in pkt_session_unset_buffers()
      https://git.kernel.org/kees/c/cdddb626dc05

Take care,
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c
index 7f0802a5518c..3418d2dd9371 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.c
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.c
@@ -251,8 +251,8 @@  int pkt_session_unset_buffers(struct hfi_session_release_buffer_pkt *pkt,
 
 		pkt->extradata_size = 0;
 		pkt->shdr.hdr.size =
-			struct_size((struct hfi_session_set_buffers_pkt *)0,
-				    buffer_info, bd->num_buffers);
+			struct_size_t(struct hfi_session_set_buffers_pkt,
+				      buffer_info, bd->num_buffers);
 	}
 
 	pkt->response_req = bd->response_required;