linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] media: venus: Use struct_size_t() helper in pkt_session_unset_buffers()
@ 2023-07-01 17:17 Gustavo A. R. Silva
  2023-07-10  7:10 ` Vikash Garodia
  2023-07-27 17:11 ` Kees Cook
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2023-07-01 17:17 UTC (permalink / raw)
  To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
	Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Mauro Carvalho Chehab
  Cc: linux-media, linux-arm-msm, linux-kernel, Gustavo A. R. Silva,
	linux-hardening

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(-)

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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] media: venus: Use struct_size_t() helper in pkt_session_unset_buffers()
  2023-07-01 17:17 [PATCH][next] media: venus: Use struct_size_t() helper in pkt_session_unset_buffers() Gustavo A. R. Silva
@ 2023-07-10  7:10 ` Vikash Garodia
  2023-07-27 17:11 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Vikash Garodia @ 2023-07-10  7:10 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Stanimir Varbanov, Bryan O'Donoghue,
	Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Mauro Carvalho Chehab
  Cc: linux-media, linux-arm-msm, linux-kernel, linux-hardening


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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] media: venus: Use struct_size_t() helper in pkt_session_unset_buffers()
  2023-07-01 17:17 [PATCH][next] media: venus: Use struct_size_t() helper in pkt_session_unset_buffers() Gustavo A. R. Silva
  2023-07-10  7:10 ` Vikash Garodia
@ 2023-07-27 17:11 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2023-07-27 17:11 UTC (permalink / raw)
  To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
	Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Mauro Carvalho Chehab, Gustavo A. R. Silva
  Cc: Kees Cook, linux-media, linux-arm-msm, linux-kernel, linux-hardening

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,

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-27 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-01 17:17 [PATCH][next] media: venus: Use struct_size_t() helper in pkt_session_unset_buffers() Gustavo A. R. Silva
2023-07-10  7:10 ` Vikash Garodia
2023-07-27 17:11 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).