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: <20250512143107.GJ3339421@horms.kernel.org>
Date: Mon, 12 May 2025 15:31:07 +0100
From: Simon Horman <horms@...nel.org>
To: Lee Trager <lee@...ger.us>
Cc: 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>,
	Andrew Lunn <andrew+netdev@...n.ch>,
	Jacob Keller <jacob.e.keller@...el.com>,
	Mohsin Bashir <mohsin.bashr@...il.com>,
	Sanman Pradhan <sanman.p211993@...il.com>,
	Su Hui <suhui@...china.com>, Al Viro <viro@...iv.linux.org.uk>,
	Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>,
	Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v4 5/5] eth: fbnic: Add devlink dev flash support

On Fri, May 09, 2025 at 05:21:17PM -0700, Lee Trager wrote:
> Add support to update the CMRT and control firmware as well as the UEFI
> driver on fbnic using devlink dev flash.
> 
> Make sure the shutdown / quiescence paths like suspend take the devlink
> lock to prevent them from interrupting the FW flashing process.
> 
> Signed-off-by: Lee Trager <lee@...ger.us>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>

...

> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c b/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c

...

> @@ -109,8 +111,264 @@ static int fbnic_devlink_info_get(struct devlink *devlink,
>  	return 0;
>  }
> 
> +static bool
> +fbnic_pldm_match_record(struct pldmfw *context, struct pldmfw_record *record)
> +{
> +	struct pldmfw_desc_tlv *desc;
> +	u32 anti_rollback_ver = 0;
> +	struct devlink *devlink;
> +	struct fbnic_dev *fbd;
> +	struct pci_dev *pdev;
> +
> +	/* First, use the standard PCI matching function */
> +	if (!pldmfw_op_pci_match_record(context, record))
> +		return -ENODEV;

Hi Lee,

The return type of this function is bool, but here a negative integer is
being returned. Perhaps this should be:

		return false;

Flagged by Smatch

> +
> +	pdev = to_pci_dev(context->dev);
> +	fbd = pci_get_drvdata(pdev);
> +	devlink = priv_to_devlink(fbd);
> +
> +	/* If PCI match is successful, check for vendor-specific descriptors */
> +	list_for_each_entry(desc, &record->descs, entry) {
> +		if (desc->type != PLDM_DESC_ID_VENDOR_DEFINED)
> +			continue;
> +
> +		if (desc->size < 21 || desc->data[0] != 1 ||
> +		    desc->data[1] != 15)
> +			continue;
> +
> +		if (memcmp(desc->data + 2, "AntiRollbackVer", 15) != 0)
> +			continue;
> +
> +		anti_rollback_ver = get_unaligned_le32(desc->data + 17);
> +		break;
> +	}
> +
> +	/* Compare versions and return error if they do not match */
> +	if (anti_rollback_ver < fbd->fw_cap.anti_rollback_version) {
> +		char buf[128];
> +
> +		snprintf(buf, sizeof(buf),
> +			 "New firmware anti-rollback version (0x%x) is older than device version (0x%x)!",
> +			 anti_rollback_ver, fbd->fw_cap.anti_rollback_version);
> +		devlink_flash_update_status_notify(devlink, buf,
> +						   "Anti-Rollback", 0, 0);
> +
> +		return false;
> +	}
> +
> +	return true;
> +}

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ