netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Jacob Keller <jacob.e.keller@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 12/15] i40e/i40evf: fix I40E_MASK signed shift overflow warnings
Date: Sun,  1 May 2016 17:06:18 -0700	[thread overview]
Message-ID: <1462147581-135254-13-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1462147581-135254-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Jacob Keller <jacob.e.keller@intel.com>

GCC 6 has a new warning which will display when you attempt to left
shift a signed value beyond the storage size of the type. I40E_MASK
generates a mask value for 32bit registers. Properly typecast the mask
value and place the values in parenthesis to prevent macro expansion
issues.

Signed-off-by: Jacob Keller <jacob.e.keller@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_type.h   | 2 +-
 drivers/net/ethernet/intel/i40evf/i40e_type.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index 8aa14aa..bd5f13b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -36,7 +36,7 @@
 #include "i40e_devids.h"
 
 /* I40E_MASK is a macro used on 32 bit registers */
-#define I40E_MASK(mask, shift) (mask << shift)
+#define I40E_MASK(mask, shift) ((u32)(mask) << (shift))
 
 #define I40E_MAX_VSI_QP			16
 #define I40E_MAX_VF_VSI			3
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h
index bfc97c2..97f96e0 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h
@@ -36,7 +36,7 @@
 #include "i40e_devids.h"
 
 /* I40E_MASK is a macro used on 32 bit registers */
-#define I40E_MASK(mask, shift) (mask << shift)
+#define I40E_MASK(mask, shift) ((u32)(mask) << (shift))
 
 #define I40E_MAX_VSI_QP			16
 #define I40E_MAX_VF_VSI			3
-- 
2.5.5

  parent reply	other threads:[~2016-05-02  0:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-02  0:06 [net-next 00/15][pull request] 40GbE Intel Wired LAN Driver Updates 2016-05-01 Jeff Kirsher
2016-05-02  0:06 ` [net-next 01/15] i40e: Change the default for VFs to be not privileged Jeff Kirsher
2016-05-02  0:06 ` [net-next 02/15] i40e: Limit the number of MAC and VLAN addresses that can be added for VFs Jeff Kirsher
2016-05-02  0:06 ` [net-next 03/15] i40e: Prevent falling to promiscuous if the VF is not trusted Jeff Kirsher
2016-05-02  0:06 ` [net-next 04/15] i40e: Remove HMC AQ API implementation Jeff Kirsher
2016-05-02  0:06 ` [net-next 05/15] i40evf: RSS Hash Option parameters Jeff Kirsher
2016-05-02  0:06 ` [net-next 06/15] i40e: Fix uninitialized variable Jeff Kirsher
2016-05-02  0:06 ` [net-next 07/15] i40e: PTP - avoid aggregate return warnings Jeff Kirsher
2016-05-02  0:06 ` [net-next 08/15] i40e: Use consistent type for vf_id Jeff Kirsher
2016-05-02  0:06 ` [net-next 09/15] i40e: Drop extra copy of function Jeff Kirsher
2016-05-02  0:06 ` [net-next 10/15] i40e: Update device ids for X722 Jeff Kirsher
2016-05-02  0:06 ` [net-next 11/15] i40e/i40evf : Bump driver version from 1.5.5 to 1.5.10 Jeff Kirsher
2016-05-02  0:06 ` Jeff Kirsher [this message]
2016-05-02  0:06 ` [net-next 13/15] i40e: make use of BIT() macro to prevent left shift of signed values Jeff Kirsher
2016-05-02  0:06 ` [net-next 14/15] i40evf: make use of BIT() macro to avoid signed left shift Jeff Kirsher
2016-05-02  0:06 ` [net-next 15/15] i40e/i40evf: Add support for GSO partial with UDP_TUNNEL_CSUM and GRE_CSUM Jeff Kirsher
2016-05-02  3:39 ` [net-next 00/15][pull request] 40GbE Intel Wired LAN Driver Updates 2016-05-01 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=1462147581-135254-13-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=jacob.e.keller@intel.com \
    --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).