Skip to content

Commit

Permalink
net: l2tp: fix negative assignment to unsigned int
Browse files Browse the repository at this point in the history
recv_seq, send_seq and lns_mode mode are all defined as
unsigned int foo:1;

Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.st>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Asbjørn Sloth Tønnesen authored and David S. Miller committed Nov 9, 2016
1 parent 57ceb86 commit 3f9b977
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion net/l2tp/l2tp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
l2tp_info(session, L2TP_MSG_SEQ,
"%s: requested to enable seq numbers by LNS\n",
session->name);
session->send_seq = -1;
session->send_seq = 1;
l2tp_session_set_header_len(session, tunnel->version);
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions net/l2tp/l2tp_ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ static int pppol2tp_session_setsockopt(struct sock *sk,
err = -EINVAL;
break;
}
session->recv_seq = val ? -1 : 0;
session->recv_seq = !!val;
l2tp_info(session, PPPOL2TP_MSG_CONTROL,
"%s: set recv_seq=%d\n",
session->name, session->recv_seq);
Expand All @@ -1283,7 +1283,7 @@ static int pppol2tp_session_setsockopt(struct sock *sk,
err = -EINVAL;
break;
}
session->send_seq = val ? -1 : 0;
session->send_seq = !!val;
{
struct sock *ssk = ps->sock;
struct pppox_sock *po = pppox_sk(ssk);
Expand All @@ -1301,7 +1301,7 @@ static int pppol2tp_session_setsockopt(struct sock *sk,
err = -EINVAL;
break;
}
session->lns_mode = val ? -1 : 0;
session->lns_mode = !!val;
l2tp_info(session, PPPOL2TP_MSG_CONTROL,
"%s: set lns_mode=%d\n",
session->name, session->lns_mode);
Expand Down

0 comments on commit 3f9b977

Please sign in to comment.