net: l2tp: fix negative assignment to unsigned int
authorAsbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
Mon, 7 Nov 2016 20:39:28 +0000 (20:39 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Nov 2016 23:55:36 +0000 (18:55 -0500)
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>
net/l2tp/l2tp_core.c
net/l2tp/l2tp_ppp.c

index a2ed3bda4ddcd70071bc8ac87120e5591d9dd681..85948c69b23681ef9542e43faad8af235a309828 100644 (file)
@@ -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 {
index 41d47bfda15c91ed9492ae8b516b979458e49be7..2ddfec1e4acfdea1404f555d17cc3586d4afd935 100644 (file)
@@ -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);
@@ -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);
@@ -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);