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: <20250116180632.GA594177@bhelgaas>
Date: Thu, 16 Jan 2025 12:06:32 -0600
From: Bjorn Helgaas <helgaas@...nel.org>
To: Colin Ian King <colin.i.king@...il.com>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
	Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
	Jonathan Cameron <Jonathan.Cameron@...wei.com>,
	linux-pci@...r.kernel.org, kernel-janitors@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] PCI: Fix ternary operator that never returns 0

On Thu, Jan 16, 2025 at 05:20:19PM +0000, Colin Ian King wrote:
> The left hand size of the ? operator is always true because of the addition
> of PCIE_STD_NUM_TLP_HEADERLOG and so dev->eetlp_prefix_max is always being
> returned and the 0 is never returned (dead code). Fix this by adding the
> required parentheses around the ternary operator.
> 
> Fixes: 00048c2d5f11 ("PCI: Add TLP Prefix reading to pcie_read_tlp_log()")
> Signed-off-by: Colin Ian King <colin.i.king@...il.com>

Squashed into the 00048c2d5f11 ("PCI: Add TLP Prefix reading to
pcie_read_tlp_log()") commit, headed for v6.14, thanks!

> ---
>  drivers/pci/pcie/tlp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pcie/tlp.c b/drivers/pci/pcie/tlp.c
> index 9b9e348fb1a0..0860b5da837f 100644
> --- a/drivers/pci/pcie/tlp.c
> +++ b/drivers/pci/pcie/tlp.c
> @@ -22,8 +22,8 @@
>  unsigned int aer_tlp_log_len(struct pci_dev *dev, u32 aercc)
>  {
>  	return PCIE_STD_NUM_TLP_HEADERLOG +
> -	       (aercc & PCI_ERR_CAP_PREFIX_LOG_PRESENT) ?
> -	       dev->eetlp_prefix_max : 0;
> +	       ((aercc & PCI_ERR_CAP_PREFIX_LOG_PRESENT) ?
> +		dev->eetlp_prefix_max : 0);
>  }
>  
>  #ifdef CONFIG_PCIE_DPC
> -- 
> 2.47.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ