netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sudarsana Reddy Kalluru <skalluru@marvell.com>
To: Colin King <colin.king@canonical.com>,
	Ariel Elior <aelior@marvell.com>,
	GR-everest-linux-l2 <GR-everest-linux-l2@marvell.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Eilon Greenstein <eilong@broadcom.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [EXT] [PATCH] bnx2x: Fix potential infinite loop
Date: Thu, 8 Apr 2021 01:44:23 +0000	[thread overview]
Message-ID: <PH0PR18MB403997479411C615A95E6E71D3749@PH0PR18MB4039.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20210407142802.495539-1-colin.king@canonical.com>


> -----Original Message-----
> From: Colin King <colin.king@canonical.com>
> Sent: Wednesday, April 7, 2021 7:58 PM
> To: Ariel Elior <aelior@marvell.com>; Sudarsana Reddy Kalluru
> <skalluru@marvell.com>; GR-everest-linux-l2 <GR-everest-linux-
> l2@marvell.com>; David S . Miller <davem@davemloft.net>; Jakub Kicinski
> <kuba@kernel.org>; Eilon Greenstein <eilong@broadcom.com>;
> netdev@vger.kernel.org
> Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [EXT] [PATCH] bnx2x: Fix potential infinite loop
> 
> External Email
> 
> ----------------------------------------------------------------------
> From: Colin Ian King <colin.king@canonical.com>
> 
> The for_each_tx_queue loop iterates with a u8 loop counter i and compares
> this with the loop upper limit of bp->num_queues that is an int type.  There
> is a potential infinite loop if bp->num_queues is larger than the u8 loop
> counter. Fix this by making the loop counter the same type as bp-
> >num_queues.
> 
> Addresses-Coverity: ("Infinite loop")
> Fixes: ad5afc89365e ("bnx2x: Separate VF and PF logic")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> index 1a6ec1a12d53..edfbeb710ad4 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> @@ -2959,7 +2959,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int
> load_mode)
> 
>  int bnx2x_drain_tx_queues(struct bnx2x *bp)  {
> -	u8 rc = 0, cos, i;
> +	u8 rc = 0, cos;
> +	int i;
> 
>  	/* Wait until tx fastpath tasks complete */
>  	for_each_tx_queue(bp, i) {
> --
> 2.30.2

Thanks for the change. [just for the info, theoretical max num_queues value for bnx2x device is 33]

Acked-by: Sudarsana Reddy Kalluru <skalluru@marvell.com>

      parent reply	other threads:[~2021-04-08  1:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 14:28 [PATCH] bnx2x: Fix potential infinite loop Colin King
2021-04-07 22:13 ` David Miller
2021-04-08  1:44 ` Sudarsana Reddy Kalluru [this message]

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=PH0PR18MB403997479411C615A95E6E71D3749@PH0PR18MB4039.namprd18.prod.outlook.com \
    --to=skalluru@marvell.com \
    --cc=GR-everest-linux-l2@marvell.com \
    --cc=aelior@marvell.com \
    --cc=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=eilong@broadcom.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).