2021-06-10 17:18:46

by Lakshmi Ramasubramanian

[permalink] [raw]
Subject: [PATCH 2/2] ima: Fix warning: no previous prototype for function 'ima_post_key_create_or_update'

The function prototype for ima_post_key_create_or_update() is present
in 'linux/ima.h'. But this header file is not included in
ima_asymmetric_keys.c where the function is implemented. This results
in the following compiler warning when "-Wmissing-prototypes" flag
is turned on:

security/integrity/ima/ima_asymmetric_keys.c:29:6: warning: no previous
prototype for 'ima_post_key_create_or_update' [-Wmissing-prototypes]

Include the header file 'linux/ima.h' in ima_asymmetric_keys.c to
fix the compiler warning.

Fixes: 88e70da170e8 (IMA: Define an IMA hook to measure keys)
Cc: [email protected]
Signed-off-by: Lakshmi Ramasubramanian <[email protected]>
---
security/integrity/ima/ima_asymmetric_keys.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/security/integrity/ima/ima_asymmetric_keys.c b/security/integrity/ima/ima_asymmetric_keys.c
index 1fb0b0e09559..c985418698a4 100644
--- a/security/integrity/ima/ima_asymmetric_keys.c
+++ b/security/integrity/ima/ima_asymmetric_keys.c
@@ -11,6 +11,7 @@

#include <keys/asymmetric-type.h>
#include <linux/user_namespace.h>
+#include <linux/ima.h>
#include "ima.h"

/**
--
2.25.1


2021-06-10 17:39:05

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 2/2] ima: Fix warning: no previous prototype for function 'ima_post_key_create_or_update'

On Thu, Jun 10, 2021 at 12:16 PM Lakshmi Ramasubramanian
<[email protected]> wrote:
>
> The function prototype for ima_post_key_create_or_update() is present
> in 'linux/ima.h'. But this header file is not included in
> ima_asymmetric_keys.c where the function is implemented. This results
> in the following compiler warning when "-Wmissing-prototypes" flag
> is turned on:
>
> security/integrity/ima/ima_asymmetric_keys.c:29:6: warning: no previous
> prototype for 'ima_post_key_create_or_update' [-Wmissing-prototypes]
>
> Include the header file 'linux/ima.h' in ima_asymmetric_keys.c to
> fix the compiler warning.
>
> Fixes: 88e70da170e8 (IMA: Define an IMA hook to measure keys)
> Cc: [email protected]
> Signed-off-by: Lakshmi Ramasubramanian <[email protected]>
> ---
> security/integrity/ima/ima_asymmetric_keys.c | 1 +
> 1 file changed, 1 insertion(+)

Acked-by: Rob Herring <[email protected]>

2021-06-11 01:26:01

by Mimi Zohar

[permalink] [raw]
Subject: Re: [PATCH 2/2] ima: Fix warning: no previous prototype for function 'ima_post_key_create_or_update'

Hi Lakshmi,

On Thu, 2021-06-10 at 10:15 -0700, Lakshmi Ramasubramanian wrote:
> The function prototype for ima_post_key_create_or_update() is present
> in 'linux/ima.h'. But this header file is not included in
> ima_asymmetric_keys.c where the function is implemented. This results
> in the following compiler warning when "-Wmissing-prototypes" flag
> is turned on:
>
> security/integrity/ima/ima_asymmetric_keys.c:29:6: warning: no previous
> prototype for 'ima_post_key_create_or_update' [-Wmissing-prototypes]
>
> Include the header file 'linux/ima.h' in ima_asymmetric_keys.c to
> fix the compiler warning.
>
> Fixes: 88e70da170e8 (IMA: Define an IMA hook to measure keys)
> Cc: [email protected]
> Signed-off-by: Lakshmi Ramasubramanian <[email protected]>

Roberto posted an equivalent patch "[PATCH 4/5] ima: Include header
defining ima_post_key_create_or_update()" earlier this week.

Compiler warnings don't meet the requirements for stable -
Documentation/process/stable-kernel-rules.rst.

thanks,

Mimi