svn commit: r354609 - stable/12/sys/net

Hans Petter Selasky hselasky at FreeBSD.org
Mon Nov 11 14:41:06 UTC 2019


Author: hselasky
Date: Mon Nov 11 14:41:05 2019
New Revision: 354609
URL: https://svnweb.freebsd.org/changeset/base/354609

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/12/sys/net/vnet.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/vnet.h
==============================================================================
--- stable/12/sys/net/vnet.h	Mon Nov 11 14:07:11 2019	(r354608)
+++ stable/12/sys/net/vnet.h	Mon Nov 11 14:41:05 2019	(r354609)
@@ -325,6 +325,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,							\
@@ -337,6 +339,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