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]
Date: Fri, 22 Dec 2023 15:30:11 +0000
From: Cristian Marussi <cristian.marussi@....com>
To: "Peng Fan (OSS)" <peng.fan@....nxp.com>
Cc: Sudeep Holla <sudeep.holla@....com>, Rob Herring <robh+dt@...nel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Oleksii Moisieiev <oleksii_moisieiev@...m.com>,
	Linus Walleij <linus.walleij@...aro.org>,
	Shawn Guo <shawnguo@...nel.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>,
	NXP Linux Team <linux-imx@....com>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	devicetree@...r.kernel.org, linux-gpio@...r.kernel.org,
	Peng Fan <peng.fan@....com>
Subject: Re: [PATCH 1/7] firmware: arm_scmi: introduce helper get_max_msg_size

On Fri, Dec 15, 2023 at 07:56:29PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@....com>
> 
> When Agent sending data to SCMI server, the Agent driver could check
> the size to avoid protocol buffer overflow. So introduce the helper
> get_max_msg_size.
> 
> Signed-off-by: Peng Fan <peng.fan@....com>
> ---
>  drivers/firmware/arm_scmi/driver.c    | 15 +++++++++++++++
>  drivers/firmware/arm_scmi/protocols.h |  1 +
>  2 files changed, 16 insertions(+)
> 
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index a9f70e6e58ac..b4f8f190351b 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -1481,6 +1481,20 @@ static int scmi_common_extended_name_get(const struct scmi_protocol_handle *ph,
>  	return ret;
>  }
>  
> +/**
> + * scmi_common_get_max_msg_size  - Get maximum message size
> + * @ph: A protocol handle reference.
> + *
> + * Return: Maximum message size for the current protocol.
> + */
> +static int scmi_common_get_max_msg_size(const struct scmi_protocol_handle *ph)
> +{
> +	const struct scmi_protocol_instance *pi = ph_to_pi(ph);
> +	struct scmi_info *info = handle_to_scmi_info(pi->handle);
> +
> +	return info->desc->max_msg_size;
> +}
> +
>  /**
>   * struct scmi_iterator  - Iterator descriptor
>   * @msg: A reference to the message TX buffer; filled by @prepare_message with
> @@ -1756,6 +1770,7 @@ static void scmi_common_fastchannel_db_ring(struct scmi_fc_db_info *db)
>  
>  static const struct scmi_proto_helpers_ops helpers_ops = {
>  	.extended_name_get = scmi_common_extended_name_get,
> +	.get_max_msg_size = scmi_common_get_max_msg_size,
>  	.iter_response_init = scmi_iterator_init,
>  	.iter_response_run = scmi_iterator_run,
>  	.fastchannel_init = scmi_common_fastchannel_init,
> diff --git a/drivers/firmware/arm_scmi/protocols.h b/drivers/firmware/arm_scmi/protocols.h
> index e683c26f24eb..08de8dc064c1 100644
> --- a/drivers/firmware/arm_scmi/protocols.h
> +++ b/drivers/firmware/arm_scmi/protocols.h
> @@ -270,6 +270,7 @@ struct scmi_proto_helpers_ops {
>  				 void __iomem **p_addr,
>  				 struct scmi_fc_db_info **p_db);
>  	void (*fastchannel_db_ring)(struct scmi_fc_db_info *db);
> +	int (*get_max_msg_size)(const struct scmi_protocol_handle *ph);
>  };

This looks good to me, but please add a comment for this new helper in
the comment block above.

Other than that:

Reviewed-by: Cristian Marussi <cristian.marussi@....com>

Thanks,
Cristian


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ