[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241019093402.GT1697@kernel.org>
Date: Sat, 19 Oct 2024 10:34:02 +0100
From: Simon Horman <horms@...nel.org>
To: Lee Trager <lee@...ger.us>
Cc: Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Alexander Duyck <alexanderduyck@...com>,
Jakub Kicinski <kuba@...nel.org>, kernel-team@...a.com,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Jonathan Corbet <corbet@....net>,
Mohsin Bashir <mohsin.bashr@...il.com>,
Sanman Pradhan <sanmanpradhan@...a.com>,
Al Viro <viro@...iv.linux.org.uk>, netdev@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 2/2] eth: fbnic: Add devlink dev flash support
On Fri, Oct 18, 2024 at 03:48:26PM -0700, Lee Trager wrote:
> On 10/15/24 3:43 AM, Simon Horman wrote:
>
> > On Mon, Oct 14, 2024 at 12:18:36PM +0100, Vadim Fedorenko wrote:
> > > On 12/10/2024 03:34, Lee Trager wrote:
> > > > fbnic supports updating firmware using a PLDM image signed and distributed
> > > > by Meta. PLDM images are written into stored flashed. Flashing does not
> > > > interrupt operation.
> > > >
> > > > On host reboot the newly flashed UEFI driver will be used. To run new
> > > > control or cmrt firmware the NIC must be power cycled.
> > > >
> > > > Signed-off-by: Lee Trager <lee@...ger.us>
> > ...
> >
> > > > diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c b/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
> > ...
> >
> > > > +/**
> > > > + * fbnic_send_component_table - Send PLDM component table to the firmware
> > > > + * @context: PLDM FW update structure
> > > > + * @component: The component to send
> > > > + * @transfer_flag: Flag indication location in component tables
> > > > + *
> > > > + * Read relevant data from component table and forward it to the firmware.
> > > > + * Check response to verify if the firmware indicates that it wishes to
> > > > + * proceed with the update.
> > > > + *
> > > > + * Return: zero on success
> > > > + * negative error code on failure
> > > > + */
> > > > +static int fbnic_send_component_table(struct pldmfw *context,
> > > > + struct pldmfw_component *component,
> > > > + u8 transfer_flag)
> > > > +{
> > > > + struct device *dev = context->dev;
> > > > + u16 id = component->identifier;
> > > > + u8 test_string[80];
> > > > +
> > > > + switch (id) {
> > > > + case QSPI_SECTION_CMRT:
> > > > + case QSPI_SECTION_CONTROL_FW:
> > > > + case QSPI_SECTION_OPTION_ROM:
> > > > + break;
> > > > + default:
> > > > + dev_err(dev, "Unknown component ID %u\n", id);
> > > > + return -EINVAL;
> > > > + }
> > > > +
> > > > + dev_dbg(dev, "Sending PLDM component table to firmware\n");
> > > > +
> > > > + /* Temp placeholder */
> > > > + memcpy(test_string, component->version_string,
> > > > + min_t(u8, component->version_len, 79));
> > > > + test_string[min_t(u8, component->version_len, 79)] = 0;
> > > Looks like this construction can be replaced with strscpy().
> > > There were several patchsets in the tree to use strscpy(), let's follow
> > > the pattern.
> > While looking at these lines, I'm unsure why min_t() is being used
> > instead of min() here. As version_len is unsigned and 79 is a positive
> > constant, I believe min() should be fine here.
>
> clang complains if I'm not explicit with the type by using min_t()
Thanks, and sorry for not checking what clang says.
That is a good enough reason for this for me.
...
Powered by blists - more mailing lists