[PATCH] keys: drop shadowing dead prototype

Christian Göttsche posted 1 patch 1 year, 2 months ago
include/keys/system_keyring.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] keys: drop shadowing dead prototype
Posted by Christian Göttsche 1 year, 2 months ago
From: Christian Göttsche <cgzones@googlemail.com>

The global variable pkcs7 does not exist.
Drop the variable declaration, but keep the struct prototype needed for
is_key_on_revocation_list().

Reported by clang:

    ./include/keys/system_keyring.h:104:67: warning: declaration shadows a variable in the global scope [-Wshadow]
      104 | static inline int is_key_on_revocation_list(struct pkcs7_message *pkcs7)
          |                                                                   ^
    ./include/keys/system_keyring.h:76:30: note: previous declaration is here
       76 | extern struct pkcs7_message *pkcs7;
          |                              ^

Fixes: 56c5812623f9 ("certs: Add EFI_CERT_X509_GUID support for dbx entries")
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 include/keys/system_keyring.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/keys/system_keyring.h b/include/keys/system_keyring.h
index 8365adf842ef..a6c2897bcc63 100644
--- a/include/keys/system_keyring.h
+++ b/include/keys/system_keyring.h
@@ -73,7 +73,6 @@ static inline void __init set_machine_trusted_keys(struct key *keyring)
 }
 #endif
 
-extern struct pkcs7_message *pkcs7;
 #ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
 extern int mark_hash_blacklisted(const u8 *hash, size_t hash_len,
 			       enum blacklist_hash_type hash_type);
@@ -93,6 +92,7 @@ static inline int is_binary_blacklisted(const u8 *hash, size_t hash_len)
 }
 #endif
 
+struct pkcs7_message;
 #ifdef CONFIG_SYSTEM_REVOCATION_LIST
 extern int add_key_to_revocation_list(const char *data, size_t size);
 extern int is_key_on_revocation_list(struct pkcs7_message *pkcs7);
-- 
2.45.2

Re: [PATCH] keys: drop shadowing dead prototype
Posted by Jarkko Sakkinen 1 year, 2 months ago
On Mon Nov 25, 2024 at 1:03 PM EET, Christian Göttsche wrote:
> From: Christian Göttsche <cgzones@googlemail.com>
>
> The global variable pkcs7 does not exist.
> Drop the variable declaration, but keep the struct prototype needed for
> is_key_on_revocation_list().
>
> Reported by clang:
>
>     ./include/keys/system_keyring.h:104:67: warning: declaration shadows a variable in the global scope [-Wshadow]
>       104 | static inline int is_key_on_revocation_list(struct pkcs7_message *pkcs7)
>           |                                                                   ^
>     ./include/keys/system_keyring.h:76:30: note: previous declaration is here
>        76 | extern struct pkcs7_message *pkcs7;
>           |                              ^
>
> Fixes: 56c5812623f9 ("certs: Add EFI_CERT_X509_GUID support for dbx entries")
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> ---
>  include/keys/system_keyring.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/keys/system_keyring.h b/include/keys/system_keyring.h
> index 8365adf842ef..a6c2897bcc63 100644
> --- a/include/keys/system_keyring.h
> +++ b/include/keys/system_keyring.h
> @@ -73,7 +73,6 @@ static inline void __init set_machine_trusted_keys(struct key *keyring)
>  }
>  #endif
>  
> -extern struct pkcs7_message *pkcs7;
>  #ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
>  extern int mark_hash_blacklisted(const u8 *hash, size_t hash_len,
>  			       enum blacklist_hash_type hash_type);
> @@ -93,6 +92,7 @@ static inline int is_binary_blacklisted(const u8 *hash, size_t hash_len)
>  }
>  #endif
>  
> +struct pkcs7_message;
>  #ifdef CONFIG_SYSTEM_REVOCATION_LIST
>  extern int add_key_to_revocation_list(const char *data, size_t size);
>  extern int is_key_on_revocation_list(struct pkcs7_message *pkcs7);

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko