[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250818192203.364c73b1@kernel.org>
Date: Mon, 18 Aug 2025 19:22:03 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Ivan Vecera <ivecera@...hat.com>
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
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.
> +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.
Powered by blists - more mailing lists