Module Name: src Committed By: pgoyette Date: Thu Apr 26 09:37:22 UTC 2018
Modified Files: src/sys/compat/common [pgoyette-compat]: uipc_syscalls_50.c Log Message: Import rev 1.5 from HEAD To generate a diff of this commit: cvs rdiff -u -r1.3.56.6 -r1.3.56.7 src/sys/compat/common/uipc_syscalls_50.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/compat/common/uipc_syscalls_50.c diff -u src/sys/compat/common/uipc_syscalls_50.c:1.3.56.6 src/sys/compat/common/uipc_syscalls_50.c:1.3.56.7 --- src/sys/compat/common/uipc_syscalls_50.c:1.3.56.6 Mon Apr 16 03:41:34 2018 +++ src/sys/compat/common/uipc_syscalls_50.c Thu Apr 26 09:37:22 2018 @@ -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 @@ compat_ifdatareq(struct lwp *l, u_long c 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 @@ compat_ifdatareq(struct lwp *l, u_long c return 0; default: + /* Impossible due to above validation, but makes gcc happy. */ return ENOSYS; } }