diff mbox series

selinux: make header files self-including

Message ID 20230511123236.723025-1-cgzones@googlemail.com (mailing list archive)
State Superseded
Delegated to: Paul Moore
Headers show
Series selinux: make header files self-including | expand

Commit Message

Christian Göttsche May 11, 2023, 12:32 p.m. UTC
Include all necessary headers in header files to enable third party
applications, like LSP servers, to resolve all used symbols.

ibpkey.h: include "../flask.h" for SECINITSID_UNLABELED
initial_sid_to_string.h: include <linux/stddef.h> for NULL

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 security/selinux/include/ibpkey.h                | 1 +
 security/selinux/include/initial_sid_to_string.h | 3 +++
 2 files changed, 4 insertions(+)

Comments

kernel test robot May 12, 2023, 2:13 a.m. UTC | #1
Hi Christian,

kernel test robot noticed the following build errors:

[auto build test ERROR on pcmoore-selinux/next]
[also build test ERROR on linus/master v6.4-rc1 next-20230511]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Christian-G-ttsche/selinux-make-header-files-self-including/20230511-203619
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git next
patch link:    https://lore.kernel.org/r/20230511123236.723025-1-cgzones%40googlemail.com
patch subject: [PATCH] selinux: make header files self-including
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20230512/202305121044.Q88iF2NQ-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/2b237d995d423baa5707fe9f59441d4744892eda
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Christian-G-ttsche/selinux-make-header-files-self-including/20230511-203619
        git checkout 2b237d995d423baa5707fe9f59441d4744892eda
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305121044.Q88iF2NQ-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from security/selinux/ibpkey.c:26:
>> security/selinux/include/ibpkey.h:18:10: fatal error: ../flask.h: No such file or directory
      18 | #include "../flask.h"
         |          ^~~~~~~~~~~~
   compilation terminated.


vim +18 security/selinux/include/ibpkey.h

    16	
    17	#include <linux/types.h>
  > 18	#include "../flask.h"
    19
diff mbox series

Patch

diff --git a/security/selinux/include/ibpkey.h b/security/selinux/include/ibpkey.h
index c992f83b0aae..f8a791b07092 100644
--- a/security/selinux/include/ibpkey.h
+++ b/security/selinux/include/ibpkey.h
@@ -15,6 +15,7 @@ 
 #define _SELINUX_IB_PKEY_H
 
 #include <linux/types.h>
+#include "../flask.h"
 
 #ifdef CONFIG_SECURITY_INFINIBAND
 void sel_ib_pkey_flush(void);
diff --git a/security/selinux/include/initial_sid_to_string.h b/security/selinux/include/initial_sid_to_string.h
index 60820517aa43..ecc6e74fa09b 100644
--- a/security/selinux/include/initial_sid_to_string.h
+++ b/security/selinux/include/initial_sid_to_string.h
@@ -1,4 +1,7 @@ 
 /* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/stddef.h>
+
 static const char *const initial_sid_to_string[] = {
 	NULL,
 	"kernel",