Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/pci glxsb(4): Prune dead branches. Assert ses...



details:   https://anonhg.NetBSD.org/src/rev/aa282e6f3c8b
branches:  trunk
changeset: 366326:aa282e6f3c8b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun May 22 11:38:12 2022 +0000

description:
glxsb(4): Prune dead branches.  Assert session id validity.

diffstat:

 sys/arch/i386/pci/glxsb.c |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (43 lines):

diff -r 44d6504969e7 -r aa282e6f3c8b sys/arch/i386/pci/glxsb.c
--- a/sys/arch/i386/pci/glxsb.c Sun May 22 11:38:02 2022 +0000
+++ b/sys/arch/i386/pci/glxsb.c Sun May 22 11:38:12 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: glxsb.c,v 1.17 2022/05/22 11:35:21 riastradh Exp $     */
+/*     $NetBSD: glxsb.c,v 1.18 2022/05/22 11:38:12 riastradh Exp $     */
 /* $OpenBSD: glxsb.c,v 1.7 2007/02/12 14:31:45 tom Exp $ */
 
 /*
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.17 2022/05/22 11:35:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.18 2022/05/22 11:38:12 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -314,8 +314,7 @@
        struct glxsb_session *ses = NULL;
        int sesn;
 
-       if (sc == NULL || sidp == NULL || cri == NULL ||
-           cri->cri_next != NULL || cri->cri_alg != CRYPTO_AES_CBC ||
+       if (cri->cri_next != NULL || cri->cri_alg != CRYPTO_AES_CBC ||
            cri->cri_klen != 128)
                return (EINVAL);
 
@@ -360,11 +359,10 @@
        int sesn;
        uint32_t sid = ((uint32_t)tid) & 0xffffffff;
 
-       if (sc == NULL)
-               return (EINVAL);
        sesn = GLXSB_SESSION(sid);
-       if (sesn >= sc->sc_nsessions)
-               return (EINVAL);
+       KASSERTMSG(sesn < sc->sc_nsessions, "sesn=%d nsessions=%d",
+           sesn, sc->sc_nsessions);
+
        memset(&sc->sc_sessions[sesn], 0, sizeof(sc->sc_sessions[sesn]));
        return (0);
 }



Home | Main Index | Thread Index | Old Index