[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200708065330.GA348669@kroah.com>
Date: Wed, 8 Jul 2020 08:53:30 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Saheed Olayemi Bolarinwa <refactormyself@...il.com>
Cc: helgaas@...nel.org, Arnd Bergmann <arnd@...db.de>,
bjorn@...gaas.com, skhan@...uxfoundation.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/13] misc: rtsx: Check the return value of
pcie_capability_read_*()
On Wed, Jul 08, 2020 at 12:03:13AM +0200, Saheed Olayemi Bolarinwa wrote:
> From: Bolarinwa Olayemi Saheed <refactormyself@...il.com>
>
> On failure pcie_capability_read_dword() sets it's last parameter, val
> to 0. In which case (val & PCI_EXP_DEVCTL2_LTR_EN) evaluates to 0.
> However, with Patch 13/13, it is possible that val is set to ~0 on
> failure. This would introduce a bug because (x & x) == (~0 & x).
>
> This bug can be avoided without changing the function's behaviour if the
> return value of pcie_capability_read_word is checked to confirm success.
>
> Check the return value of pcie_capability_read_word() to ensure success.
>
> Suggested-by: Bjorn Helgaas <bjorn@...gaas.com>
> Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@...il.com>
Acked-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Powered by blists - more mailing lists