mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/1] check the ioremap return value first (supplementary CC)
       [not found] <20250618092544.53696-1-chuguangqing@inspur.com>
@ 2025-06-19  7:11 ` chuguangqing
  2025-06-19  7:11   ` [PATCH 1/1] ixgbe: " chuguangqing
  0 siblings, 1 reply; 7+ messages in thread
From: chuguangqing @ 2025-06-19  7:11 UTC (permalink / raw)
  To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, chuguangqing

Always check ioremap() return value  before use.

chuguangqing (1):
  ixgbe: check the ioremap return value first

 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.43.5


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

* [PATCH 1/1] ixgbe: check the ioremap return value first (supplementary CC)
  2025-06-19  7:11 ` [PATCH 0/1] check the ioremap return value first (supplementary CC) chuguangqing
@ 2025-06-19  7:11   ` chuguangqing
  2025-06-19  7:29     ` Paolo Abeni
  0 siblings, 1 reply; 7+ messages in thread
From: chuguangqing @ 2025-06-19  7:11 UTC (permalink / raw)
  To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, chuguangqing

We should first check whether the ioremap return value is NULL before using it.

Signed-off-by: chuguangqing <chuguangqing@inspur.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 6eccfba51fac..97a49463b09d 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -11431,11 +11431,11 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	hw->hw_addr = ioremap(pci_resource_start(pdev, 0),
 			      pci_resource_len(pdev, 0));
-	adapter->io_addr = hw->hw_addr;
 	if (!hw->hw_addr) {
 		err = -EIO;
 		goto err_ioremap;
 	}
+	adapter->io_addr = hw->hw_addr;
 
 	/* Setup hw api */
 	hw->mac.ops   = *ii->mac_ops;
-- 
2.43.5


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

* Re: [PATCH 1/1] ixgbe: check the ioremap return value first (supplementary CC)
  2025-06-19  7:11   ` [PATCH 1/1] ixgbe: " chuguangqing
@ 2025-06-19  7:29     ` Paolo Abeni
  2025-06-19 12:48       ` Re: [PATCH 1/1] " chuguangqing
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo Abeni @ 2025-06-19  7:29 UTC (permalink / raw)
  To: chuguangqing, Tony Nguyen, Przemek Kitszel, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski
  Cc: linux-kernel

On 6/19/25 9:11 AM, chuguangqing wrote:
> We should first check whether the ioremap return value is NULL before using it.
> 
> Signed-off-by: chuguangqing <chuguangqing@inspur.com>

You are not CC-ing any of the relevant ML (netdev@vger.kernel.org -
intel-wired-lan@lists.osuosl.org): this patch will be lost.

/P


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

* Re: Re: [PATCH 1/1] check the ioremap return value first (supplementary CC)
  2025-06-19  7:29     ` Paolo Abeni
@ 2025-06-19 12:48       ` chuguangqing
  2025-06-23  8:45         ` Przemek Kitszel
  0 siblings, 1 reply; 7+ messages in thread
From: chuguangqing @ 2025-06-19 12:48 UTC (permalink / raw)
  To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, netdev, intel-wired-lan

 tks to pabeni. 
 cc the relevant ML in the email.


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

* Re: [PATCH 1/1] check the ioremap return value first (supplementary CC)
  2025-06-19 12:48       ` Re: [PATCH 1/1] " chuguangqing
@ 2025-06-23  8:45         ` Przemek Kitszel
  2025-06-24  2:58           ` chuguangqing
  0 siblings, 1 reply; 7+ messages in thread
From: Przemek Kitszel @ 2025-06-23  8:45 UTC (permalink / raw)
  To: chuguangqing
  Cc: linux-kernel, netdev, intel-wired-lan, Tony Nguyen, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni

On 6/19/25 14:48, chuguangqing wrote:
>   tks to pabeni.
>   cc the relevant ML in the email.
> 

Thank you for reaching out with the patch, it is an attempt to
fix something observable?

I have found the original topic via web search [1]. It looks that the
proposed patch does not change anything - adapter->io_addr was null
also before the assignment, so it does not hurt as-is. And the check
afterwards is equally effective for me to prevent subsequent
dereference.

[1] https://lkml.org/lkml/2025/6/19/343


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

* Re: Re: [PATCH 1/1] check the ioremap return value first (supplementary CC)
  2025-06-23  8:45         ` Przemek Kitszel
@ 2025-06-24  2:58           ` chuguangqing
  2025-06-24  2:58             ` [PATCH 0/1] " chuguangqing
  0 siblings, 1 reply; 7+ messages in thread
From: chuguangqing @ 2025-06-24  2:58 UTC (permalink / raw)
  To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, netdev, intel-wired-lan

First of all, thank you for your reply. Yes, this patch doesn't change anything substantial. It's merely for demonstrating good programming practices, so you can decide whether to apply it or not.

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

* [PATCH 0/1] check the ioremap return value first (supplementary CC)
  2025-06-24  2:58           ` chuguangqing
@ 2025-06-24  2:58             ` chuguangqing
  0 siblings, 0 replies; 7+ messages in thread
From: chuguangqing @ 2025-06-24  2:58 UTC (permalink / raw)
  To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, netdev, intel-wired-lan, chuguangqing

Always check ioremap() return value  before use.

chuguangqing (1):
  ixgbe: check the ioremap return value first

 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.43.5


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

end of thread, other threads:[~2025-06-24  3:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20250618092544.53696-1-chuguangqing@inspur.com>
2025-06-19  7:11 ` [PATCH 0/1] check the ioremap return value first (supplementary CC) chuguangqing
2025-06-19  7:11   ` [PATCH 1/1] ixgbe: " chuguangqing
2025-06-19  7:29     ` Paolo Abeni
2025-06-19 12:48       ` Re: [PATCH 1/1] " chuguangqing
2025-06-23  8:45         ` Przemek Kitszel
2025-06-24  2:58           ` chuguangqing
2025-06-24  2:58             ` [PATCH 0/1] " chuguangqing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®