svn commit: r354610 - stable/11/sys/net

Hans Petter Selasky hselasky at FreeBSD.org
Mon Nov 11 14:49:46 UTC 2019


Author: hselasky
Date: Mon Nov 11 14:49:45 2019
New Revision: 354610
URL: https://svnweb.freebsd.org/changeset/base/354610

Log:
  MFC r353275:
  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.
  
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/net/vnet.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/vnet.h
==============================================================================
--- stable/11/sys/net/vnet.h	Mon Nov 11 14:41:05 2019	(r354609)
+++ stable/11/sys/net/vnet.h	Mon Nov 11 14:49:45 2019	(r354610)
@@ -308,6 +308,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,							\
@@ -320,6 +322,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,							\


More information about the svn-src-all mailing list