From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jon Maloy <jon.maloy@ericsson.com>
Cc: Ying Xue <ying.xue@windriver.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net,
kernel-janitors@vger.kernel.org
Subject: [patch -next] tipc: potential shift wrapping bug in map_set()
Date: Fri, 17 Jun 2016 09:22:26 +0000 [thread overview]
Message-ID: <20160617092226.GD25609@mwanda> (raw)
"up_map" is a u64 type but we're not using the high 32 bits.
Fixes: 35c55c9877f8 ('tipc: add neighbor monitoring framework')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c
index 87d4efe..0d489e8 100644
--- a/net/tipc/monitor.c
+++ b/net/tipc/monitor.c
@@ -122,8 +122,8 @@ static int dom_size(int peers)
static void map_set(u64 *up_map, int i, unsigned int v)
{
- *up_map &= ~(1 << i);
- *up_map |= (v << i);
+ *up_map &= ~(1ULL << i);
+ *up_map |= ((u64)v << i);
}
static int map_get(u64 up_map, int i)
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jon Maloy <jon.maloy@ericsson.com>
Cc: Ying Xue <ying.xue@windriver.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net,
kernel-janitors@vger.kernel.org
Subject: [patch -next] tipc: potential shift wrapping bug in map_set()
Date: Fri, 17 Jun 2016 12:22:26 +0300 [thread overview]
Message-ID: <20160617092226.GD25609@mwanda> (raw)
"up_map" is a u64 type but we're not using the high 32 bits.
Fixes: 35c55c9877f8 ('tipc: add neighbor monitoring framework')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c
index 87d4efe..0d489e8 100644
--- a/net/tipc/monitor.c
+++ b/net/tipc/monitor.c
@@ -122,8 +122,8 @@ static int dom_size(int peers)
static void map_set(u64 *up_map, int i, unsigned int v)
{
- *up_map &= ~(1 << i);
- *up_map |= (v << i);
+ *up_map &= ~(1ULL << i);
+ *up_map |= ((u64)v << i);
}
static int map_get(u64 up_map, int i)
next reply other threads:[~2016-06-17 9:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-17 9:22 Dan Carpenter [this message]
2016-06-17 9:22 ` [patch -next] tipc: potential shift wrapping bug in map_set() Dan Carpenter
2016-06-17 12:01 ` Jon Maloy
2016-06-17 12:01 ` Jon Maloy
2016-06-18 4:27 ` David Miller
2016-06-18 4:27 ` 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=20160617092226.GD25609@mwanda \
--to=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=jon.maloy@ericsson.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.