From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Konstantin Ananyev <konstantin.ananyev@intel.com>,
Jasvinder Singh <jasvinder.singh@intel.com>,
Olivier Matz <olivier.matz@6wind.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH 1/3] lib: fix shifting 32 bits signed variable 31 times
Date: Sun, 28 Oct 2018 01:08:44 +0000 [thread overview]
Message-ID: <20181028010846.81730-1-ferruh.yigit@intel.com> (raw)
Fix cppcheck warning by marking variable as unsigned.
Fixes: dc276b5780c2 ("acl: new library")
Fixes: 986ff526fb84 ("net: add CRC computation API")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
lib/librte_acl/acl_gen.c | 2 +-
lib/librte_net/rte_net_crc.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/librte_acl/acl_gen.c b/lib/librte_acl/acl_gen.c
index bed66be08..35a0140b4 100644
--- a/lib/librte_acl/acl_gen.c
+++ b/lib/librte_acl/acl_gen.c
@@ -163,7 +163,7 @@ acl_count_sequential_groups(struct rte_acl_bitset *bits, int zero_one)
for (n = QRANGE_MIN; n < UINT8_MAX + 1; n++) {
if (bits->bits[n / (sizeof(bits_t) * 8)] &
- (1 << (n % (sizeof(bits_t) * 8)))) {
+ (1U << (n % (sizeof(bits_t) * 8)))) {
if (zero_one == 1 && last_bit != 1)
ranges++;
last_bit = 1;
diff --git a/lib/librte_net/rte_net_crc.c b/lib/librte_net/rte_net_crc.c
index 73ac3a959..dca0830e2 100644
--- a/lib/librte_net/rte_net_crc.c
+++ b/lib/librte_net/rte_net_crc.c
@@ -69,8 +69,8 @@ reflect_32bits(uint32_t val)
uint32_t i, res = 0;
for (i = 0; i < 32; i++)
- if ((val & (1 << i)) != 0)
- res |= (uint32_t)(1 << (31 - i));
+ if ((val & (1U << i)) != 0)
+ res |= (uint32_t)(1U << (31 - i));
return res;
}
--
2.17.2
next reply other threads:[~2018-10-28 0:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-28 1:08 Ferruh Yigit [this message]
2018-10-28 1:08 ` [dpdk-dev] [PATCH 2/3] service: fix possible NULL access Ferruh Yigit
2018-10-29 16:12 ` Van Haaren, Harry
2018-10-28 1:08 ` [dpdk-dev] [PATCH 3/3] vhost: fix possible out of bound access Ferruh Yigit
2018-10-31 17:28 ` Maxime Coquelin
2018-11-06 0:26 ` [dpdk-dev] [PATCH 1/3] lib: fix shifting 32 bits signed variable 31 times Thomas Monjalon
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=20181028010846.81730-1-ferruh.yigit@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=jasvinder.singh@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=olivier.matz@6wind.com \
--cc=stable@dpdk.org \
/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).