Date: Mon, 7 Oct 2019 14:24:59 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353275 - head/sys/net Message-ID: <201910071424.x97EOxVl069824@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon Oct 7 14:24:59 2019 New Revision: 353275 URL: https://svnweb.freebsd.org/changeset/base/353275 Log: Compile time assert a valid subsystem for all VNET init and uninit functions. Using VNET init and uninit functions outside the given range has undefined behaviour. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/net/vnet.h Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Mon Oct 7 14:15:41 2019 (r353274) +++ head/sys/net/vnet.h Mon Oct 7 14:24:59 2019 (r353275) @@ -326,6 +326,8 @@ struct vnet_sysinit { }; #define VNET_SYSINIT(ident, subsystem, order, func, arg) \ + CTASSERT((subsystem) > SI_SUB_VNET && \ + (subsystem) <= SI_SUB_VNET_DONE); \ static struct vnet_sysinit ident ## _vnet_init = { \ subsystem, \ order, \ @@ -338,6 +340,8 @@ struct vnet_sysinit { vnet_deregister_sysinit, &ident ## _vnet_init) #define VNET_SYSUNINIT(ident, subsystem, order, func, arg) \ + CTASSERT((subsystem) > SI_SUB_VNET && \ + (subsystem) <= SI_SUB_VNET_DONE); \ static struct vnet_sysinit ident ## _vnet_uninit = { \ subsystem, \ order, \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910071424.x97EOxVl069824>