All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	Casey Schaufler <casey@schaufler-ca.com>,
	KP Singh <kpsingh@chromium.org>,
	linux-security-module@vger.kernel.org,
	kernel test robot <lkp@intel.com>,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] LSM: Avoid warnings about potentially unused hook variables
Date: Wed, 13 Oct 2021 13:53:27 -0400	[thread overview]
Message-ID: <CAHC9VhT0+omwDjqrJ2BtnRfa8SSGAkyUvB6WX95E=ntf9gUbmQ@mail.gmail.com> (raw)
In-Reply-To: <20211013172847.1196305-1-keescook@chromium.org>

On Wed, Oct 13, 2021 at 1:31 PM Kees Cook <keescook@chromium.org> wrote:
>
> Building with W=1 shows many unused const variable warnings. These can
> be silenced, as we're well aware of their being potentially unused:
>
> ./include/linux/lsm_hook_defs.h:36:18: error: 'ptrace_access_check_default' defined but not used [-Werror=unused-const-variable=]
>    36 | LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child,
>       |                  ^~~~~~~~~~~~~~~~~~~
> security/security.c:706:32: note: in definition of macro 'LSM_RET_DEFAULT'
>   706 | #define LSM_RET_DEFAULT(NAME) (NAME##_default)
>       |                                ^~~~
> security/security.c:711:9: note: in expansion of macro 'DECLARE_LSM_RET_DEFAULT_int'
>   711 |         DECLARE_LSM_RET_DEFAULT_##RET(DEFAULT, NAME)
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~
> ./include/linux/lsm_hook_defs.h:36:1: note: in expansion of macro 'LSM_HOOK'
>    36 | LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child,
>       | ^~~~~~~~
>
> Cc: James Morris <jmorris@namei.org>
> Cc: "Serge E. Hallyn" <serge@hallyn.com>
> Cc: Paul Moore <paul@paul-moore.com>
> Cc: Casey Schaufler <casey@schaufler-ca.com>
> Cc: KP Singh <kpsingh@chromium.org>
> Cc: linux-security-module@vger.kernel.org
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/linux-mm/202110131608.zms53FPR-lkp@intel.com/
> Fixes: 98e828a0650f ("security: Refactor declaration of LSM hooks")
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  security/security.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Looks reasonable to me, thanks Kees.  Unless James wants to pick this
up for the security tree, I can pull this into the SElinux tree with
the io_uring change which is causing the testing robot to complain.

Acked-by: Paul Moore <paul@paul-moore.com>

> diff --git a/security/security.c b/security/security.c
> index 9ffa9e9c5c55..462f14354c2c 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -706,7 +706,7 @@ static int lsm_superblock_alloc(struct super_block *sb)
>  #define LSM_RET_DEFAULT(NAME) (NAME##_default)
>  #define DECLARE_LSM_RET_DEFAULT_void(DEFAULT, NAME)
>  #define DECLARE_LSM_RET_DEFAULT_int(DEFAULT, NAME) \
> -       static const int LSM_RET_DEFAULT(NAME) = (DEFAULT);
> +       static const int __maybe_unused LSM_RET_DEFAULT(NAME) = (DEFAULT);
>  #define LSM_HOOK(RET, DEFAULT, NAME, ...) \
>         DECLARE_LSM_RET_DEFAULT_##RET(DEFAULT, NAME)
>
> --
> 2.30.2

--
paul moore
www.paul-moore.com

  reply	other threads:[~2021-10-13 17:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 17:28 [PATCH] LSM: Avoid warnings about potentially unused hook variables Kees Cook
2021-10-13 17:53 ` Paul Moore [this message]
2021-10-13 21:51   ` James Morris
2021-10-14 20:10     ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHC9VhT0+omwDjqrJ2BtnRfa8SSGAkyUvB6WX95E=ntf9gUbmQ@mail.gmail.com' \
    --to=paul@paul-moore.com \
    --cc=casey@schaufler-ca.com \
    --cc=jmorris@namei.org \
    --cc=keescook@chromium.org \
    --cc=kpsingh@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=serge@hallyn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.