mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dipendra Khadka <kdipendra88@gmail.com>
To: andrew@lunn.ch, florian.fainelli@broadcom.com,
	davem@davemloft.net, edumazet@google.com,
	bcm-kernel-feedback-list@broadcom.com, kuba@kernel.org,
	pabeni@redhat.com
Cc: Dipendra Khadka <kdipendra88@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 net] net: Add error pointer check in bcmsysport.c
Date: Mon, 23 Sep 2024 05:38:58 +0000	[thread overview]
Message-ID: <20240923053900.1310-1-kdipendra88@gmail.com> (raw)

Add error pointer checks in bcm_sysport_map_queues() and
bcm_sysport_unmap_queues() before deferencing 'dp'.

Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
---
v2: 
  - Change the subject of the patch to net
v1:  https://lore.kernel.org/all/20240922181739.50056-1-kdipendra88@gmail.com/
 drivers/net/ethernet/broadcom/bcmsysport.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index c9faa8540859..97d2ff2329cb 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2337,6 +2337,9 @@ static int bcm_sysport_map_queues(struct net_device *dev,
 	unsigned int num_tx_queues;
 	unsigned int q, qp, port;
 
+	if (IS_ERR(dp))
+		return PRT_ERR(dp);
+
 	/* We can't be setting up queue inspection for non directly attached
 	 * switches
 	 */
@@ -2392,6 +2395,9 @@ static int bcm_sysport_unmap_queues(struct net_device *dev,
 	unsigned int num_tx_queues;
 	unsigned int q, qp, port;
 
+	if (IS_ERR(dp))
+		return PTR_ERR(dp);
+
 	port = dp->index;
 
 	num_tx_queues = slave_dev->real_num_tx_queues;
-- 
2.43.0


             reply	other threads:[~2024-09-23  5:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23  5:38 Dipendra Khadka [this message]
2024-09-23 16:19 ` Simon Horman
2024-09-23 16:39   ` Dipendra Khadka
2024-09-23 17:27     ` Florian Fainelli
2024-09-23 19:33 ` kernel test robot
2024-09-23 19:44 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240923053900.1310-1-kdipendra88@gmail.com \
    --to=kdipendra88@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®