linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* Re: [Linux-kernel-mentees] [PATCH 1/14 v3] IB/hfi1: Check the return value of pcie_capability_read_*()
  2020-07-13 17:55 [Linux-kernel-mentees] [PATCH 1/14 v3] IB/hfi1: Check the return value of pcie_capability_read_*() Saheed O. Bolarinwa
@ 2020-07-13 17:09 ` Jason Gunthorpe
  2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 3/14 v3] ath9k: " Saheed O. Bolarinwa
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Jason Gunthorpe @ 2020-07-13 17:09 UTC (permalink / raw)
  To: Saheed O. Bolarinwa; +Cc: linux-rdma, linux-kernel-mentees, linux-kernel

On Mon, Jul 13, 2020 at 07:55:25PM +0200, Saheed O. Bolarinwa wrote:
> From: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>
> 
> On failure pcie_capability_read_dword() sets it's last parameter,
> val to 0. In this case dn and up will be 0, so aspm_hw_l1_supported()
> will return false.
> However, with Patch 14/14, it is possible that val is set to ~0 on
> failure. This would introduce a bug because (x & x) == (~0 & x). So with
> dn and up being 0x02, a true value is return when the read has actually
> failed.
> 
> This bug can be avoided if the return value of pcie_capability_read_dword
> is checked to confirm success. The behaviour of the function remains
> intact.
> 
> Check the return value of pcie_capability_read_dword() to ensure success.
> 
> Suggested-by: Bjorn Helgaas <bjorn@helgaas.com>
> Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>
>  drivers/infiniband/hw/hfi1/aspm.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/hfi1/aspm.c b/drivers/infiniband/hw/hfi1/aspm.c
> index a3c53be4072c..80d0b3edd983 100644
> +++ b/drivers/infiniband/hw/hfi1/aspm.c
> @@ -24,6 +24,7 @@ static bool aspm_hw_l1_supported(struct hfi1_devdata *dd)
>  {
>  	struct pci_dev *parent = dd->pcidev->bus->self;
>  	u32 up, dn;
> +	int ret_up, ret_dn;
>  
>  	/*
>  	 * If the driver does not have access to the upstream component,
> @@ -32,14 +33,14 @@ static bool aspm_hw_l1_supported(struct hfi1_devdata *dd)
>  	if (!parent)
>  		return false;
>  
> -	pcie_capability_read_dword(dd->pcidev, PCI_EXP_LNKCAP, &dn);
> +	ret_dn = pcie_capability_read_dword(dd->pcidev, PCI_EXP_LNKCAP, &dn);
>  	dn = ASPM_L1_SUPPORTED(dn);
>  
> -	pcie_capability_read_dword(parent, PCI_EXP_LNKCAP, &up);
> +	ret_up = pcie_capability_read_dword(parent, PCI_EXP_LNKCAP, &up);
>  	up = ASPM_L1_SUPPORTED(up);
>  
>  	/* ASPM works on A-step but is reported as not supported */
> -	return (!!dn || is_ax(dd)) && !!up;
> +	return !!ret_dn && !!ret_up && (!!dn || is_ax(dd)) && !!up;
>  }

what is all the !! for? boolean contexts already coerce to boolean

Jason
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Linux-kernel-mentees] [PATCH 1/14 v3] IB/hfi1: Check the return value of pcie_capability_read_*()
@ 2020-07-13 17:55 Saheed O. Bolarinwa
  2020-07-13 17:09 ` Jason Gunthorpe
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Saheed O. Bolarinwa @ 2020-07-13 17:55 UTC (permalink / raw)
  To: skhan, linux-rdma, linux-kernel-mentees, linux-kernel
  Cc: Bolarinwa Olayemi Saheed

From: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>

On failure pcie_capability_read_dword() sets it's last parameter,
val to 0. In this case dn and up will be 0, so aspm_hw_l1_supported()
will return false.
However, with Patch 14/14, it is possible that val is set to ~0 on
failure. This would introduce a bug because (x & x) == (~0 & x). So with
dn and up being 0x02, a true value is return when the read has actually
failed.

This bug can be avoided if the return value of pcie_capability_read_dword
is checked to confirm success. The behaviour of the function remains
intact.

Check the return value of pcie_capability_read_dword() to ensure success.

Suggested-by: Bjorn Helgaas <bjorn@helgaas.com>
Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>
---
 drivers/infiniband/hw/hfi1/aspm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/aspm.c b/drivers/infiniband/hw/hfi1/aspm.c
index a3c53be4072c..80d0b3edd983 100644
--- a/drivers/infiniband/hw/hfi1/aspm.c
+++ b/drivers/infiniband/hw/hfi1/aspm.c
@@ -24,6 +24,7 @@ static bool aspm_hw_l1_supported(struct hfi1_devdata *dd)
 {
 	struct pci_dev *parent = dd->pcidev->bus->self;
 	u32 up, dn;
+	int ret_up, ret_dn;
 
 	/*
 	 * If the driver does not have access to the upstream component,
@@ -32,14 +33,14 @@ static bool aspm_hw_l1_supported(struct hfi1_devdata *dd)
 	if (!parent)
 		return false;
 
-	pcie_capability_read_dword(dd->pcidev, PCI_EXP_LNKCAP, &dn);
+	ret_dn = pcie_capability_read_dword(dd->pcidev, PCI_EXP_LNKCAP, &dn);
 	dn = ASPM_L1_SUPPORTED(dn);
 
-	pcie_capability_read_dword(parent, PCI_EXP_LNKCAP, &up);
+	ret_up = pcie_capability_read_dword(parent, PCI_EXP_LNKCAP, &up);
 	up = ASPM_L1_SUPPORTED(up);
 
 	/* ASPM works on A-step but is reported as not supported */
-	return (!!dn || is_ax(dd)) && !!up;
+	return !!ret_dn && !!ret_up && (!!dn || is_ax(dd)) && !!up;
 }
 
 /* Set L1 entrance latency for slower entry to L1 */
-- 
2.18.2

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Linux-kernel-mentees] [PATCH 3/14 v3] ath9k: Check the return value of pcie_capability_read_*()
  2020-07-13 17:55 [Linux-kernel-mentees] [PATCH 1/14 v3] IB/hfi1: Check the return value of pcie_capability_read_*() Saheed O. Bolarinwa
  2020-07-13 17:09 ` Jason Gunthorpe
@ 2020-07-13 17:55 ` Saheed O. Bolarinwa
  2020-07-20 17:09   ` Kalle Valo
  2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 4/14 v3] iwlegacy: " Saheed O. Bolarinwa
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Saheed O. Bolarinwa @ 2020-07-13 17:55 UTC (permalink / raw)
  To: skhan, linux-pci, linux-kernel-mentees, linux-kernel,
	QCA ath9k Development, linux-wireless, netdev
  Cc: Bolarinwa Olayemi Saheed, Kalle Valo

From: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>

On failure pcie_capability_read_dword() sets it's last parameter, val
to 0. However, with Patch 14/14, 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_dword is checked to confirm success.

Check the return value of pcie_capability_read_dword() to ensure success.

Suggested-by: Bjorn Helgaas <bjorn@helgaas.com>
Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>

---
 drivers/net/wireless/ath/ath9k/pci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index f3461b193c7a..cff9af3af38d 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -825,6 +825,7 @@ static void ath_pci_aspm_init(struct ath_common *common)
 	struct pci_dev *pdev = to_pci_dev(sc->dev);
 	struct pci_dev *parent;
 	u16 aspm;
+	int ret;
 
 	if (!ah->is_pciexpress)
 		return;
@@ -866,8 +867,8 @@ static void ath_pci_aspm_init(struct ath_common *common)
 	if (AR_SREV_9462(ah))
 		pci_read_config_dword(pdev, 0x70c, &ah->config.aspm_l1_fix);
 
-	pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm);
-	if (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1)) {
+	ret = pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm);
+	if (!ret && (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1))) {
 		ah->aspm_enabled = true;
 		/* Initialize PCIe PM and SERDES registers. */
 		ath9k_hw_configpcipowersave(ah, false);
-- 
2.18.2

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Linux-kernel-mentees] [PATCH 4/14 v3] iwlegacy: Check the return value of pcie_capability_read_*()
  2020-07-13 17:55 [Linux-kernel-mentees] [PATCH 1/14 v3] IB/hfi1: Check the return value of pcie_capability_read_*() Saheed O. Bolarinwa
  2020-07-13 17:09 ` Jason Gunthorpe
  2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 3/14 v3] ath9k: " Saheed O. Bolarinwa
@ 2020-07-13 17:55 ` Saheed O. Bolarinwa
  2020-07-15 16:47   ` Kalle Valo
  2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 8/14 v3] PCI/ACPI: " Saheed O. Bolarinwa
  2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 12/14 v3] PCI/AER: " Saheed O. Bolarinwa
  4 siblings, 1 reply; 9+ messages in thread
From: Saheed O. Bolarinwa @ 2020-07-13 17:55 UTC (permalink / raw)
  To: skhan, linux-pci, linux-kernel-mentees, linux-kernel,
	Stanislaw Gruszka, linux-wireless, netdev
  Cc: Bolarinwa Olayemi Saheed, Kalle Valo

From: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>

On failure pcie_capability_read_dword() sets it's last parameter, val
to 0. However, with Patch 14/14, 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_dword is checked to confirm success.

Check the return value of pcie_capability_read_dword() to ensure success.

Suggested-by: Bjorn Helgaas <bjorn@helgaas.com>
Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>

---
 drivers/net/wireless/intel/iwlegacy/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c
index 348c17ce72f5..f78e062df572 100644
--- a/drivers/net/wireless/intel/iwlegacy/common.c
+++ b/drivers/net/wireless/intel/iwlegacy/common.c
@@ -4286,8 +4286,8 @@ il_apm_init(struct il_priv *il)
 	 *    power savings, even without L1.
 	 */
 	if (il->cfg->set_l0s) {
-		pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl);
-		if (lctl & PCI_EXP_LNKCTL_ASPM_L1) {
+		ret = pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl);
+		if (!ret && (lctl & PCI_EXP_LNKCTL_ASPM_L1)) {
 			/* L1-ASPM enabled; disable(!) L0S  */
 			il_set_bit(il, CSR_GIO_REG,
 				   CSR_GIO_REG_VAL_L0S_ENABLED);
-- 
2.18.2

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Linux-kernel-mentees] [PATCH 8/14 v3] PCI/ACPI: Check the return value of pcie_capability_read_*()
  2020-07-13 17:55 [Linux-kernel-mentees] [PATCH 1/14 v3] IB/hfi1: Check the return value of pcie_capability_read_*() Saheed O. Bolarinwa
                   ` (2 preceding siblings ...)
  2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 4/14 v3] iwlegacy: " Saheed O. Bolarinwa
@ 2020-07-13 17:55 ` Saheed O. Bolarinwa
  2020-07-14 13:27   ` Rafael J. Wysocki
  2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 12/14 v3] PCI/AER: " Saheed O. Bolarinwa
  4 siblings, 1 reply; 9+ messages in thread
From: Saheed O. Bolarinwa @ 2020-07-13 17:55 UTC (permalink / raw)
  To: skhan, linux-acpi, linux-pci, linux-kernel-mentees, linux-kernel
  Cc: Bolarinwa Olayemi Saheed

From: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>

On failure pcie_capability_read_dword() sets it's last parameter,
val to 0.
However, with Patch 14/14, 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 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@helgaas.com>
Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>
---
 drivers/pci/pci-acpi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 7224b1e5f2a8..39eb816bc3b8 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -248,12 +248,13 @@ static bool pcie_root_rcb_set(struct pci_dev *dev)
 {
 	struct pci_dev *rp = pcie_find_root_port(dev);
 	u16 lnkctl;
+	int ret;
 
 	if (!rp)
 		return false;
 
-	pcie_capability_read_word(rp, PCI_EXP_LNKCTL, &lnkctl);
-	if (lnkctl & PCI_EXP_LNKCTL_RCB)
+	ret = pcie_capability_read_word(rp, PCI_EXP_LNKCTL, &lnkctl);
+	if (!ret && (lnkctl & PCI_EXP_LNKCTL_RCB))
 		return true;
 
 	return false;
@@ -792,12 +793,13 @@ bool pciehp_is_native(struct pci_dev *bridge)
 {
 	const struct pci_host_bridge *host;
 	u32 slot_cap;
+	int ret;
 
 	if (!IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE))
 		return false;
 
-	pcie_capability_read_dword(bridge, PCI_EXP_SLTCAP, &slot_cap);
-	if (!(slot_cap & PCI_EXP_SLTCAP_HPC))
+	ret = pcie_capability_read_dword(bridge, PCI_EXP_SLTCAP, &slot_cap);
+	if (ret || !(slot_cap & PCI_EXP_SLTCAP_HPC))
 		return false;
 
 	if (pcie_ports_native)
-- 
2.18.2

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Linux-kernel-mentees] [PATCH 12/14 v3] PCI/AER: Check the return value of pcie_capability_read_*()
  2020-07-13 17:55 [Linux-kernel-mentees] [PATCH 1/14 v3] IB/hfi1: Check the return value of pcie_capability_read_*() Saheed O. Bolarinwa
                   ` (3 preceding siblings ...)
  2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 8/14 v3] PCI/ACPI: " Saheed O. Bolarinwa
@ 2020-07-13 17:55 ` Saheed O. Bolarinwa
  4 siblings, 0 replies; 9+ messages in thread
From: Saheed O. Bolarinwa @ 2020-07-13 17:55 UTC (permalink / raw)
  To: skhan, linux-pci, linuxppc-dev, linux-kernel-mentees, linux-kernel
  Cc: Bolarinwa Olayemi Saheed

From: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>

On failure pcie_capability_read_dword() sets it's last parameter,
val to 0.
However, with Patch 14/14, 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 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@helgaas.com>
Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>
---
 drivers/pci/pcie/aer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 3acf56683915..f4beb47c622c 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -800,6 +800,7 @@ static bool is_error_source(struct pci_dev *dev, struct aer_err_info *e_info)
 	int aer = dev->aer_cap;
 	u32 status, mask;
 	u16 reg16;
+	int ret;
 
 	/*
 	 * When bus id is equal to 0, it might be a bad id
@@ -828,8 +829,8 @@ static bool is_error_source(struct pci_dev *dev, struct aer_err_info *e_info)
 		return false;
 
 	/* Check if AER is enabled */
-	pcie_capability_read_word(dev, PCI_EXP_DEVCTL, &reg16);
-	if (!(reg16 & PCI_EXP_AER_FLAGS))
+	ret = pcie_capability_read_word(dev, PCI_EXP_DEVCTL, &reg16);
+	if (ret || !(reg16 & PCI_EXP_AER_FLAGS))
 		return false;
 
 	if (!aer)
-- 
2.18.2

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH 8/14 v3] PCI/ACPI: Check the return value of pcie_capability_read_*()
  2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 8/14 v3] PCI/ACPI: " Saheed O. Bolarinwa
@ 2020-07-14 13:27   ` Rafael J. Wysocki
  0 siblings, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2020-07-14 13:27 UTC (permalink / raw)
  To: Saheed O. Bolarinwa
  Cc: ACPI Devel Maling List, Linux PCI, Linux Kernel Mailing List,
	linux-kernel-mentees

On Mon, Jul 13, 2020 at 6:55 PM Saheed O. Bolarinwa
<refactormyself@gmail.com> wrote:
>
> From: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>
>
> On failure pcie_capability_read_dword() sets it's last parameter,
> val to 0.
> However, with Patch 14/14, 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 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@helgaas.com>
> Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  drivers/pci/pci-acpi.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index 7224b1e5f2a8..39eb816bc3b8 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -248,12 +248,13 @@ static bool pcie_root_rcb_set(struct pci_dev *dev)
>  {
>         struct pci_dev *rp = pcie_find_root_port(dev);
>         u16 lnkctl;
> +       int ret;
>
>         if (!rp)
>                 return false;
>
> -       pcie_capability_read_word(rp, PCI_EXP_LNKCTL, &lnkctl);
> -       if (lnkctl & PCI_EXP_LNKCTL_RCB)
> +       ret = pcie_capability_read_word(rp, PCI_EXP_LNKCTL, &lnkctl);
> +       if (!ret && (lnkctl & PCI_EXP_LNKCTL_RCB))
>                 return true;
>
>         return false;
> @@ -792,12 +793,13 @@ bool pciehp_is_native(struct pci_dev *bridge)
>  {
>         const struct pci_host_bridge *host;
>         u32 slot_cap;
> +       int ret;
>
>         if (!IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE))
>                 return false;
>
> -       pcie_capability_read_dword(bridge, PCI_EXP_SLTCAP, &slot_cap);
> -       if (!(slot_cap & PCI_EXP_SLTCAP_HPC))
> +       ret = pcie_capability_read_dword(bridge, PCI_EXP_SLTCAP, &slot_cap);
> +       if (ret || !(slot_cap & PCI_EXP_SLTCAP_HPC))
>                 return false;
>
>         if (pcie_ports_native)
> --
> 2.18.2
>
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH 4/14 v3] iwlegacy: Check the return value of pcie_capability_read_*()
  2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 4/14 v3] iwlegacy: " Saheed O. Bolarinwa
@ 2020-07-15 16:47   ` Kalle Valo
  0 siblings, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2020-07-15 16:47 UTC (permalink / raw)
  To: Saheed O. Bolarinwa
  Cc: Stanislaw Gruszka, linux-pci, Bolarinwa Olayemi Saheed,
	linux-wireless, linux-kernel, netdev, linux-kernel-mentees

"Saheed O. Bolarinwa" <refactormyself@gmail.com> wrote:

> From: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>
> 
> On failure pcie_capability_read_dword() sets it's last parameter, val
> to 0. However, with Patch 14/14, 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_dword is checked to confirm success.
> 
> Check the return value of pcie_capability_read_dword() to ensure success.
> 
> Suggested-by: Bjorn Helgaas <bjorn@helgaas.com>
> Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>

Patch applied to wireless-drivers-next.git, thanks.

9018fd7f2a73 iwlegacy: Check the return value of pcie_capability_read_*()

-- 
https://patchwork.kernel.org/patch/11660739/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH 3/14 v3] ath9k: Check the return value of pcie_capability_read_*()
  2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 3/14 v3] ath9k: " Saheed O. Bolarinwa
@ 2020-07-20 17:09   ` Kalle Valo
  0 siblings, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2020-07-20 17:09 UTC (permalink / raw)
  To: Saheed O. Bolarinwa
  Cc: linux-pci, Bolarinwa Olayemi Saheed, linux-wireless,
	QCA ath9k Development, linux-kernel, netdev,
	linux-kernel-mentees

"Saheed O. Bolarinwa" <refactormyself@gmail.com> wrote:

> On failure pcie_capability_read_dword() sets it's last parameter, val
> to 0. However, with Patch 14/14, 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_dword is checked to confirm success.
> 
> Check the return value of pcie_capability_read_dword() to ensure success.
> 
> Suggested-by: Bjorn Helgaas <bjorn@helgaas.com>
> Signed-off-by: Bolarinwa Olayemi Saheed <refactormyself@gmail.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

9a8ab2bfb678 ath9k: Check the return value of pcie_capability_read_*()

-- 
https://patchwork.kernel.org/patch/11660731/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-07-20 17:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13 17:55 [Linux-kernel-mentees] [PATCH 1/14 v3] IB/hfi1: Check the return value of pcie_capability_read_*() Saheed O. Bolarinwa
2020-07-13 17:09 ` Jason Gunthorpe
2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 3/14 v3] ath9k: " Saheed O. Bolarinwa
2020-07-20 17:09   ` Kalle Valo
2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 4/14 v3] iwlegacy: " Saheed O. Bolarinwa
2020-07-15 16:47   ` Kalle Valo
2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 8/14 v3] PCI/ACPI: " Saheed O. Bolarinwa
2020-07-14 13:27   ` Rafael J. Wysocki
2020-07-13 17:55 ` [Linux-kernel-mentees] [PATCH 12/14 v3] PCI/AER: " Saheed O. Bolarinwa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).