net/i40e: fix unintended sign extension
authorSlawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Fri, 20 May 2016 13:03:36 +0000 (15:03 +0200)
committerBruce Richardson <bruce.richardson@intel.com>
Wed, 15 Jun 2016 15:13:55 +0000 (17:13 +0200)
commit6e15a19c625f6f6f86149d32145fcd2b525cb2f6
tree1ffe495a1bcd25cf8e7492c79c06cac9a75f1a44
parent43e5488c0ac63b5bbeeaadcc4852c50966744cb9
net/i40e: fix unintended sign extension

Suspicious implicit sign extension: pf->fdir.match_counter_index
with type unsigned short (16 bits, unsigned) is promoted in
"pf->fdir.match_counter_index << 20" to type int (32 bits, signed),
then sign-extended to type unsigned long (64 bits, unsigned).
If "pf->fdir.match_counter_index << 20" is greater than 0x7FFFFFFF,
the upper bits of the result will all be 1.

To fix the issue explicitly cast pf->fdir.match_counter_index to uint32_t.

Coverity issue: 13315
Fixes: 05999aab4ca6 ("i40e: add or delete flow director")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
drivers/net/i40e/i40e_fdir.c