Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 2019 14:49:46 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r354610 - stable/11/sys/net
Message-ID:  <201911111449.xABEnkhi098455@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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,							\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911111449.xABEnkhi098455>