From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Lihong Yang <lihong.yang@intel.com>,
netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 10/14] i40e: add check for return from find_first_bit call
Date: Mon, 9 Oct 2017 15:38:37 -0700 [thread overview]
Message-ID: <20171009223841.2557-11-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <20171009223841.2557-1-jeffrey.t.kirsher@intel.com>
From: Lihong Yang <lihong.yang@intel.com>
The find_first_bit function will return the size passed to search
if the first set bit is not found. This patch adds the check in case
that happens as the return value would be used as the index in an array
and that would have caused the out-of-bounds access.
Detected by CoverityScan, CID 1295969 Out-of-bounds access
Signed-off-by: Lihong Yang <lihong.yang@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 83727906a386..125dcd1d2233 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -306,6 +306,10 @@ static void i40e_config_irq_link_list(struct i40e_vf *vf, u16 vsi_id,
next_q = find_first_bit(&linklistmap,
(I40E_MAX_VSI_QP *
I40E_VIRTCHNL_SUPPORTED_QTYPES));
+ if (unlikely(next_q == (I40E_MAX_VSI_QP *
+ I40E_VIRTCHNL_SUPPORTED_QTYPES)))
+ goto irq_list_done;
+
vsi_queue_id = next_q / I40E_VIRTCHNL_SUPPORTED_QTYPES;
qtype = next_q % I40E_VIRTCHNL_SUPPORTED_QTYPES;
pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id);
--
2.14.2
next prev parent reply other threads:[~2017-10-09 22:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 22:38 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-10-09 Jeff Kirsher
2017-10-09 22:38 ` [net-next 01/14] i40e: fix flags declaration Jeff Kirsher
2017-10-09 22:38 ` [net-next 02/14] i40e: use the safe hash table iterator when deleting mac filters Jeff Kirsher
2017-10-09 22:38 ` [net-next 03/14] i40evf: fix mac filter removal timing issue Jeff Kirsher
2017-10-09 22:38 ` [net-next 04/14] i40e/i40evf: fix incorrect default ITR values on driver load Jeff Kirsher
2017-10-09 22:38 ` [net-next 05/14] i40e/i40evf: always set the CLEARPBA flag when re-enabling interrupts Jeff Kirsher
2017-10-10 13:07 ` David Laight
2017-10-09 22:38 ` [net-next 06/14] i40e: reduce lrxqthresh from 2 to 1 Jeff Kirsher
2017-10-09 22:38 ` [net-next 07/14] i40e/i40evf: bump tail only in multiples of 8 Jeff Kirsher
2017-10-09 22:38 ` [net-next 08/14] i40e/i40evf: bundle more descriptors when allocating buffers Jeff Kirsher
2017-10-09 22:38 ` [net-next 09/14] i40e: allow XPS with QoS enabled Jeff Kirsher
2017-10-09 22:38 ` Jeff Kirsher [this message]
2017-10-09 22:38 ` [net-next 11/14] i40e: Retry AQC GetPhyAbilities to overcome I2CRead hangs Jeff Kirsher
2017-10-09 22:38 ` [net-next 12/14] i40e: use a local variable instead of calculating multiple times Jeff Kirsher
2017-10-09 22:38 ` [net-next 13/14] i40e: fix a typo Jeff Kirsher
2017-10-09 22:38 ` [net-next 14/14] i40e: Avoid some useless variables and initializers in NVM functions Jeff Kirsher
2017-10-10 1:12 ` [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-10-09 David Miller
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=20171009223841.2557-11-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=jogreene@redhat.com \
--cc=lihong.yang@intel.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=sassmann@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