Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 2019 14:41:05 +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-12@freebsd.org
Subject:   svn commit: r354609 - stable/12/sys/net
Message-ID:  <201911111441.xABEf5eI094441@repo.freebsd.org>

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



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