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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240620193023.GS959333@kernel.org>
Date: Thu, 20 Jun 2024 20:30:23 +0100
From: Simon Horman <horms@...nel.org>
To: Danielle Ratson <danieller@...dia.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, corbet@....net,
	linux@...linux.org.uk, sdf@...gle.com, kory.maincent@...tlin.com,
	maxime.chevallier@...tlin.com, vladimir.oltean@....com,
	przemyslaw.kitszel@...el.com, ahmed.zaki@...el.com,
	richardcochran@...il.com, shayagr@...zon.com,
	paul.greenwalt@...el.com, jiri@...nulli.us,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
	mlxsw@...dia.com, idosch@...dia.com, petrm@...dia.com
Subject: Re: [PATCH net-next v6 4/9] ethtool: Add flashing transceiver
 modules' firmware notifications ability

On Wed, Jun 19, 2024 at 03:17:22PM +0300, Danielle Ratson wrote:
> Add progress notifications ability to user space while flashing modules'
> firmware by implementing the interface between the user space and the
> kernel.
> 
> Signed-off-by: Danielle Ratson <danieller@...dia.com>
> Reviewed-by: Petr Machata <petrm@...dia.com>

...

> diff --git a/net/ethtool/module.c b/net/ethtool/module.c

...

> @@ -158,3 +159,119 @@ const struct ethnl_request_ops ethnl_module_request_ops = {
>  	.set			= ethnl_set_module,
>  	.set_ntf_cmd		= ETHTOOL_MSG_MODULE_NTF,
>  };
> +
> +/* MODULE_FW_FLASH_NTF */
> +
> +static int
> +ethnl_module_fw_flash_ntf_put_err(struct sk_buff *skb, char *err_msg,
> +				  char *sub_err_msg)
> +{
> +	int err_msg_len, sub_err_msg_len, total_len;
> +	struct nlattr *attr;
> +
> +	if (!err_msg)
> +		return 0;
> +
> +	err_msg_len = strlen(err_msg);
> +	total_len = err_msg_len + 2; /* For period and NUL. */
> +
> +	if (sub_err_msg) {
> +		sub_err_msg_len = strlen(sub_err_msg);
> +		total_len += sub_err_msg_len + 2; /* For ", ". */
> +	}
> +
> +	attr = nla_reserve(skb, ETHTOOL_A_MODULE_FW_FLASH_STATUS_MSG,
> +			   total_len);
> +	if (!attr)
> +		return PTR_ERR(attr);

Hi Danielle,

attr is NULL here, so I think this will return 0.
Perhaps it should return an negative error value,
say -ENOMEM, instead?

Flagged by Smatch

> +
> +	if (sub_err_msg)
> +		sprintf(nla_data(attr), "%s, %s.", err_msg, sub_err_msg);
> +	else
> +		sprintf(nla_data(attr), "%s.", err_msg);
> +
> +	return 0;
> +}

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ