Module Name: src
Committed By: martin
Date: Sat Jan 29 17:05:45 UTC 2022
Modified Files:
src/sys/net [netbsd-8]: ppp_tty.c
Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1727):
sys/net/ppp_tty.c: revision 1.68
sys/net/ppp_tty.c: revision 1.69
Use unsigned to avoid undefined behavior in pppasyncstart().
Use unsigned to avoid undefined behavior. Found by kUBSan.
To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.8.1 src/sys/net/ppp_tty.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/ppp_tty.c
diff -u src/sys/net/ppp_tty.c:1.63 src/sys/net/ppp_tty.c:1.63.8.1
--- src/sys/net/ppp_tty.c:1.63 Sun Oct 2 14:17:07 2016
+++ src/sys/net/ppp_tty.c Sat Jan 29 17:05:44 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $ */
+/* $NetBSD: ppp_tty.c,v 1.63.8.1 2022/01/29 17:05:44 martin Exp $ */
/* Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp */
/*
@@ -93,7 +93,7 @@
/* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.63.8.1 2022/01/29 17:05:44 martin Exp $");
#ifdef _KERNEL_OPT
#include "ppp.h"
@@ -181,7 +181,7 @@ static void pppdumpframe(struct ppp_soft
/*
* Does c need to be escaped?
*/
-#define ESCAPE_P(c) (sc->sc_asyncmap[(c) >> 5] & (1 << ((c) & 0x1F)))
+#define ESCAPE_P(c) (sc->sc_asyncmap[(c) >> 5] & (1U << ((c) & 0x1F)))
/*
* Procedures for using an async tty interface for PPP.
@@ -1012,7 +1012,7 @@ pppinput(int c, struct tty *tp)
sc->sc_flags |= SC_RCV_B7_1;
else
sc->sc_flags |= SC_RCV_B7_0;
- if (paritytab[c >> 5] & (1 << (c & 0x1F)))
+ if (paritytab[c >> 5] & (1U << (c & 0x1F)))
sc->sc_flags |= SC_RCV_ODDP;
else
sc->sc_flags |= SC_RCV_EVNP;
@@ -1093,7 +1093,7 @@ pppinput(int c, struct tty *tp)
return 0;
}
- if (c < 0x20 && (sc->sc_rasyncmap & (1 << c)))
+ if (c < 0x20 && (sc->sc_rasyncmap & (1U << c)))
return 0;
s = spltty();