Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys/compat/common Import rev 1.5 from HEAD



details:   https://anonhg.NetBSD.org/src/rev/f77b106753f6
branches:  pgoyette-compat
changeset: 321169:f77b106753f6
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Thu Apr 26 09:37:22 2018 +0000

description:
Import rev 1.5 from HEAD

diffstat:

 sys/compat/common/uipc_syscalls_50.c |  20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diffs (49 lines):

diff -r 50b76e88e98b -r f77b106753f6 sys/compat/common/uipc_syscalls_50.c
--- a/sys/compat/common/uipc_syscalls_50.c      Thu Apr 26 01:58:25 2018 +0000
+++ b/sys/compat/common/uipc_syscalls_50.c      Thu Apr 26 09:37:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls_50.c,v 1.3.56.6 2018/04/16 03:41:34 pgoyette Exp $       */
+/*     $NetBSD: uipc_syscalls_50.c,v 1.3.56.7 2018/04/26 09:37:22 pgoyette Exp $       */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.3.56.6 2018/04/16 03:41:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.3.56.7 2018/04/26 09:37:22 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -66,10 +66,19 @@
        struct ifnet *ifp;
        int error;
 
-       ifp = ifunit(ifdr->ifdr_name);
-       if (ifp == NULL)
-               return ENXIO;
+       /* Validate arguments. */
+       switch (cmd) {
+       case SIOCGIFDATA:
+       case SIOCZIFDATA:
+               ifp = ifunit(ifdr->ifdr_name);
+               if (ifp == NULL)
+                       return ENXIO;
+               break;
+       default:
+               return ENOSYS;
+       }
 
+       /* Do work. */
        switch (cmd) {
        case SIOCGIFDATA:
                ifdatan2o(&ifdr->ifdr_data, &ifp->if_data);
@@ -94,6 +103,7 @@
                return 0;
 
        default:
+               /* Impossible due to above validation, but makes gcc happy. */
                return ENOSYS;
        }
 }



Home | Main Index | Thread Index | Old Index