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: Mon, 29 Apr 2024 20:11:30 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Danielle Ratson <danieller@...dia.com>
Cc: <netdev@...r.kernel.org>, <davem@...emloft.net>, <edumazet@...gle.com>,
 <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>, <petrm@...dia.com>, <idosch@...dia.com>
Subject: Re: [PATCH net-next v5 04/10] ethtool: Add flashing transceiver
 modules' firmware notifications ability

On Wed, 24 Apr 2024 16:30:17 +0300 Danielle Ratson wrote:
> +	hdr = ethnl_bcastmsg_put(skb, ETHTOOL_MSG_MODULE_FW_FLASH_NTF);
> +	if (!hdr)
> +		goto err_skb;

Do we want to blast it to all listeners or treat it as an async reply?
We can save the seq and portid of the original requester and use reply,
I think.

> +	ret = ethnl_fill_reply_header(skb, dev,
> +				      ETHTOOL_A_MODULE_FW_FLASH_HEADER);
> +	if (ret < 0)
> +		goto err_skb;
> +
> +	if (nla_put_u32(skb, ETHTOOL_A_MODULE_FW_FLASH_STATUS, status))
> +		goto err_skb;
> +
> +	if (status_msg &&
> +	    nla_put_string(skb, ETHTOOL_A_MODULE_FW_FLASH_STATUS_MSG,
> +			   status_msg))
> +		goto err_skb;
> +
> +	if (nla_put_u64_64bit(skb, ETHTOOL_A_MODULE_FW_FLASH_DONE, done,
> +			      ETHTOOL_A_MODULE_FW_FLASH_PAD))

nla_put_uint()

> +		goto err_skb;
> +
> +	if (nla_put_u64_64bit(skb, ETHTOOL_A_MODULE_FW_FLASH_TOTAL, total,
> +			      ETHTOOL_A_MODULE_FW_FLASH_PAD))

nla_put_uint()

> +		goto err_skb;
> +
> +	genlmsg_end(skb, hdr);
> +	ethnl_multicast(skb, dev);
> +	return;
> +
> +err_skb:
> +	nlmsg_free(skb);
> +}
> +
> +void ethnl_module_fw_flash_ntf_err(struct net_device *dev,
> +				   char *err_msg, char *sub_err_msg)
> +{
> +	char status_msg[120];
> +
> +	if (sub_err_msg)
> +		sprintf(status_msg, "%s, %s.", err_msg, sub_err_msg);
> +	else
> +		sprintf(status_msg, "%s.", err_msg);

Hm, printing in the dot, and assuming sizeof err_msg + sub_err < 116
is a bit surprising. But I guess you have a reason...

Maybe pass them separately to ethnl_module_fw_flash_ntf() then you can
nla_reserve() the right amount of space and sprintf() directly into the
skb?

> +	ethnl_module_fw_flash_ntf(dev, ETHTOOL_MODULE_FW_FLASH_STATUS_ERROR,
> +				  status_msg, 0, 0);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ