Message ID | 20240922181739.50056-1-kdipendra88@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Staging: net/ethernet/broadcom: Add error pointer check in bcmsysport.c | expand |
On Sun, Sep 22, 2024 at 06:17:37PM +0000, Dipendra Khadka wrote: > Smatch reported following: > ''' > drivers/net/ethernet/broadcom/bcmsysport.c:2343 bcm_sysport_map_queues() error: 'dp' dereferencing possible ERR_PTR() > drivers/net/ethernet/broadcom/bcmsysport.c:2395 bcm_sysport_unmap_queues() error: 'dp' dereferencing possible ERR_PTR() > ''' > > Adding error pointer check before dereferencing 'dp'. This driver is not in staging, so your subject is wrong. Please take a look at: https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html Andrew --- pw-bot: cr
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index c9faa8540859..b849c11e2bb6 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 PTR_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;
Smatch reported following: ''' drivers/net/ethernet/broadcom/bcmsysport.c:2343 bcm_sysport_map_queues() error: 'dp' dereferencing possible ERR_PTR() drivers/net/ethernet/broadcom/bcmsysport.c:2395 bcm_sysport_unmap_queues() error: 'dp' dereferencing possible ERR_PTR() ''' Adding error pointer check before dereferencing 'dp'. Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> --- drivers/net/ethernet/broadcom/bcmsysport.c | 6 ++++++ 1 file changed, 6 insertions(+)