netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Bruce Allan <bruce.w.allan@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 03/16] fm10k: Avoid crashing the kernel
Date: Tue,  5 Apr 2016 01:01:15 -0700	[thread overview]
Message-ID: <1459843288-40623-4-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1459843288-40623-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Bruce Allan <bruce.w.allan@intel.com>

Use BUILD_BUG_ON() instead of BUG_ON() where appropriate to get a compile
error rather than crash the kernel.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Acked-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index 28837ae..6a9f988 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -398,7 +398,7 @@ static void fm10k_get_reg_q(struct fm10k_hw *hw, u32 *buff, int i)
 	buff[idx++] = fm10k_read_reg(hw, FM10K_TX_SGLORT(i));
 	buff[idx++] = fm10k_read_reg(hw, FM10K_PFVTCTL(i));
 
-	BUG_ON(idx != FM10K_REGS_LEN_Q);
+	BUILD_BUG_ON(idx != FM10K_REGS_LEN_Q);
 }
 
 /* If function above adds more registers this define needs to be updated */
@@ -414,7 +414,7 @@ static void fm10k_get_reg_vsi(struct fm10k_hw *hw, u32 *buff, int i)
 	for (j = 0; j < 32; j++)
 		buff[idx++] = fm10k_read_reg(hw, FM10K_RETA(i, j));
 
-	BUG_ON(idx != FM10K_REGS_LEN_VSI);
+	BUILD_BUG_ON(idx != FM10K_REGS_LEN_VSI);
 }
 
 static void fm10k_get_regs(struct net_device *netdev,
-- 
2.5.5

  parent reply	other threads:[~2016-04-05  8:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-05  8:01 [net-next 00/16][pull request] 100GbE Intel Wired LAN Driver Updates 2016-04-05 Jeff Kirsher
2016-04-05  8:01 ` [net-next 01/16] fm10k: Move constants to the right of binary operators Jeff Kirsher
2016-04-05  8:01 ` [net-next 02/16] fm10k: cleanup remaining right-bit-shifted 1 Jeff Kirsher
2016-04-05  8:01 ` Jeff Kirsher [this message]
2016-04-05  8:13   ` [net-next 03/16] fm10k: Avoid crashing the kernel Joe Perches
2016-04-05 16:12   ` David Miller
2016-04-06 23:24     ` Keller, Jacob E
2016-04-05  8:01 ` [net-next 04/16] fm10k: demote BUG_ON() to WARN_ON() where appropriate Jeff Kirsher
2016-04-05  8:01 ` [net-next 05/16] fm10k: cleanup SPACE_BEFORE_TAB checkpatch warning Jeff Kirsher
2016-04-05  8:01 ` [net-next 06/16] fm10k: use ether_addr_copy to copy MAC address Jeff Kirsher
2016-04-05  8:01 ` [net-next 07/16] fm10k: prevent null pointer dereference of msix_entries table Jeff Kirsher
2016-04-05  8:01 ` [net-next 08/16] fm10k: don't initialize service task until later in probe Jeff Kirsher
2016-04-05  8:01 ` [net-next 09/16] fm10k: base queue scheme covered by RSS Jeff Kirsher
2016-04-05  8:01 ` [net-next 10/16] fm10k: print error message when stop_hw fails Jeff Kirsher
2016-04-05  8:01 ` [net-next 11/16] fm10k: free MBX IRQ before clearing interrupt scheme Jeff Kirsher
2016-04-05  8:01 ` [net-next 12/16] fm10k: add helper functions to set strings and data for ethtool stats Jeff Kirsher
2016-04-05  8:01 ` [net-next 13/16] fm10k: prevent possibly uninitialized variable Jeff Kirsher
2016-04-05  8:01 ` [net-next 14/16] fm10k: correctly clean up when init_queueing_scheme fails Jeff Kirsher
2016-04-05  8:01 ` [net-next 15/16] fm10k: fix a minor typo in some comments Jeff Kirsher
2016-04-05  8:01 ` [net-next 16/16] fm10k: use ethtool_rxfh_indir_default for default redirection table Jeff Kirsher

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=1459843288-40623-4-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=bruce.w.allan@intel.com \
    --cc=davem@davemloft.net \
    --cc=jogreene@redhat.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;
as well as URLs for NNTP newsgroup(s).