aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-01-08 21:46:04 -0500
committerDavid S. Miller <davem@davemloft.net>2016-01-08 21:46:04 -0500
commitb1c1f23ef0c64fb7e54c5b44015640e068643023 (patch)
tree5b50c46c472dc148225223c3ff4718dfe80694fb
parentirda: toim3232-sir: delete some dead code (diff)
parentbatman-adv: Fix invalid read while copying bat_iv.bcast_own (diff)
downloadwireguard-linux-b1c1f23ef0c64fb7e54c5b44015640e068643023.tar.xz
wireguard-linux-b1c1f23ef0c64fb7e54c5b44015640e068643023.zip
Merge tag 'batman-adv-fix-for-davem' of git://git.open-mesh.org/linux-merge
Antonio Quartulli says: ==================== Included change: - Fix invalid read while copying bat_iv.bcast_own by Sven Eckelmann ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--net/batman-adv/bat_iv_ogm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 912d9c36fb1c..aa94b4ec766a 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -185,7 +185,8 @@ unlock:
static int batadv_iv_ogm_orig_del_if(struct batadv_orig_node *orig_node,
int max_if_num, int del_if_num)
{
- int chunk_size, ret = -ENOMEM, if_offset;
+ int ret = -ENOMEM;
+ size_t chunk_size, if_offset;
void *data_ptr = NULL;
spin_lock_bh(&orig_node->bat_iv.ogm_cnt_lock);
@@ -203,8 +204,9 @@ static int batadv_iv_ogm_orig_del_if(struct batadv_orig_node *orig_node,
memcpy(data_ptr, orig_node->bat_iv.bcast_own, del_if_num * chunk_size);
/* copy second part */
+ if_offset = (del_if_num + 1) * chunk_size;
memcpy((char *)data_ptr + del_if_num * chunk_size,
- orig_node->bat_iv.bcast_own + ((del_if_num + 1) * chunk_size),
+ (uint8_t *)orig_node->bat_iv.bcast_own + if_offset,
(max_if_num - del_if_num) * chunk_size);
free_bcast_own: