* [patch -mainline] fm10k: drop upper bits of VLAN ID
@ 2015-01-30 8:41 Dan Carpenter
2015-01-30 10:50 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-01-30 8:41 UTC (permalink / raw)
To: Jeff Kirsher, Alexander Duyck
Cc: Jesse Brandeburg, Bruce Allan, Carolyn Wyborny, Don Skidmore,
Greg Rose, Matthew Vick, John Ronciak, Mitch Williams, Linux NICS,
e1000-devel, netdev, kernel-janitors
Static checkers complain that the shifts in "(vid << 4) >> 4" perfectly
cancel each other out and the code is a no-op. "vid" is a u16. The
comment says that the intention here is to drop the upper bits so I have
added a cast to "u16" to do that.
Fixes: 401b5383c6c9 ('fm10k: Add support for configuring PF interface')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static analysis. Not tested.
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
index 275423d..ee30d06 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
@@ -335,7 +335,7 @@ static s32 fm10k_update_xc_addr_pf(struct fm10k_hw *hw, u16 glort,
return FM10K_ERR_PARAM;
/* drop upper 4 bits of VLAN ID */
- vid = (vid << 4) >> 4;
+ vid = (u16)(vid << 4) >> 4;
/* record fields */
mac_update.mac_lower = cpu_to_le32(((u32)mac[2] << 24) |
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [patch -mainline] fm10k: drop upper bits of VLAN ID
2015-01-30 8:41 [patch -mainline] fm10k: drop upper bits of VLAN ID Dan Carpenter
@ 2015-01-30 10:50 ` Dan Carpenter
2015-01-30 17:05 ` Vick, Matthew
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-01-30 10:50 UTC (permalink / raw)
To: Jeff Kirsher, Alexander Duyck
Cc: kernel-janitors, Linux NICS, e1000-devel, Bruce Allan,
Jesse Brandeburg, John Ronciak, netdev
On Fri, Jan 30, 2015 at 11:41:27AM +0300, Dan Carpenter wrote:
> Static checkers complain that the shifts in "(vid << 4) >> 4" perfectly
> cancel each other out and the code is a no-op. "vid" is a u16. The
> comment says that the intention here is to drop the upper bits so I have
> added a cast to "u16" to do that.
>
> Fixes: 401b5383c6c9 ('fm10k: Add support for configuring PF interface')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Oh... Rasmus Villemoes already fixed this.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch -mainline] fm10k: drop upper bits of VLAN ID
2015-01-30 10:50 ` Dan Carpenter
@ 2015-01-30 17:05 ` Vick, Matthew
0 siblings, 0 replies; 3+ messages in thread
From: Vick, Matthew @ 2015-01-30 17:05 UTC (permalink / raw)
To: Dan Carpenter, Kirsher, Jeffrey T, Alexander Duyck
Cc: kernel-janitors@vger.kernel.org,
e1000-devel@lists.sourceforge.net, Allan, Bruce W,
Brandeburg, Jesse, Linux NICS, Ronciak, John,
netdev@vger.kernel.org
On 1/30/15, 2:50 AM, "Dan Carpenter" <dan.carpenter@oracle.com> wrote:
>On Fri, Jan 30, 2015 at 11:41:27AM +0300, Dan Carpenter wrote:
>> Static checkers complain that the shifts in "(vid << 4) >> 4" perfectly
>> cancel each other out and the code is a no-op. "vid" is a u16. The
>> comment says that the intention here is to drop the upper bits so I have
>> added a cast to "u16" to do that.
>>
>> Fixes: 401b5383c6c9 ('fm10k: Add support for configuring PF interface')
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>Oh... Rasmus Villemoes already fixed this.
>
>regards,
>dan carpenter
Yep, we have a patch coming through Jeff's tree now to resolve the issue
(technically my version of the patch, which doesn't try to mask off the
bits but instead rejects an out-of-bounds VLAN ID). Thanks, Dan!
Cheers,
Matthew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-30 17:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-30 8:41 [patch -mainline] fm10k: drop upper bits of VLAN ID Dan Carpenter
2015-01-30 10:50 ` Dan Carpenter
2015-01-30 17:05 ` Vick, Matthew
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox