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]
Message-ID: <94247dbc-4be8-4464-ad3e-5b81bba5f70b@redhat.com>
Date: Fri, 29 Aug 2025 12:39:30 +0200
From: Ivan Vecera <ivecera@...hat.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, Jiri Pirko <jiri@...nulli.us>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
 Jonathan Corbet <corbet@....net>,
 Prathosh Satish <Prathosh.Satish@...rochip.com>, linux-doc@...r.kernel.org,
 linux-kernel@...r.kernel.org, Michal Schmidt <mschmidt@...hat.com>,
 Petr Oros <poros@...hat.com>, Przemek Kitszel <przemyslaw.kitszel@...el.com>
Subject: Re: [PATCH net-next v3 3/5] dpll: zl3073x: Add firmware loading
 functionality

Hi Kuba,
sorry for the late response... (I was on PTO last 2 weeks).

On 19. 08. 25 4:22 dop., Jakub Kicinski wrote:
> On Wed, 13 Aug 2025 19:44:06 +0200 Ivan Vecera wrote:
>> +#define ZL3073X_FW_ERR_MSG(_zldev, _extack, _msg, ...)			\
>> +	do {								\
>> +		dev_err((_zldev)->dev, ZL3073X_FW_ERR_PFX _msg "\n",	\
>> +			## __VA_ARGS__);				\
>> +		NL_SET_ERR_MSG_FMT_MOD((_extack),			\
>> +				       ZL3073X_FW_ERR_PFX _msg,		\
>> +				       ## __VA_ARGS__);			\
>> +	} while (0)
> 
> Please don't duplicate the messages to the logs.
> If devlink error reporting doesn't work it needs to be fixed
> in the core.

OK, will fix this.

>> +static ssize_t
>> +zl3073x_fw_component_load(struct zl3073x_dev *zldev,
>> +			  struct zl3073x_fw_component **pcomp,
>> +			  const char **psrc, size_t *psize,
>> +			  struct netlink_ext_ack *extack)
>> +{
>> +	const struct zl3073x_fw_component_info *info;
>> +	struct zl3073x_fw_component *comp = NULL;
>> +	struct device *dev = zldev->dev;
>> +	enum zl3073x_fw_component_id id;
>> +	char buf[32], name[16];
>> +	u32 count, size, *dest;
>> +	int pos, rc;
>> +
>> +	/* Fetch image name and size from input */
>> +	strscpy(buf, *psrc, min(sizeof(buf), *psize));
>> +	rc = sscanf(buf, "%15s %u %n", name, &count, &pos);
>> +	if (!rc) {
>> +		/* No more data */
>> +		return 0;
>> +	} else if (rc == 1) {
>> +		ZL3073X_FW_ERR_MSG(zldev, extack, "invalid component size");
>> +		return -EINVAL;
>> +	}
>> +	*psrc += pos;
>> +	*psize -= pos;
> 
> what if pos > *psize ? I think the parsing needs more care.

This should not happen. strscpy copies min(32, *psize) from the source
to buf and sscanf parses buf and fills pos by index from the buf.
The pos cannot be greater than *psize...or did I miss something?

Thanks,
Ivan


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ