linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/9] selinux: declare path parameters of _genfs_sid const
@ 2022-01-25 14:14 Christian Göttsche
  2022-01-25 14:14 ` [PATCH 3/9] selinux: declare name parameter of hash_eval const Christian Göttsche
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Christian Göttsche @ 2022-01-25 14:14 UTC (permalink / raw)
  To: selinux
  Cc: Paul Moore, Stephen Smalley, Eric Paris, Nathan Chancellor,
	Nick Desaulniers, Ondrej Mosnacek, Xiong Zhenwu, Tyler Hicks,
	Serge Hallyn, Austin Kim, Yang Li, Lakshmi Ramasubramanian,
	Jeff Vander Stoep, linux-kernel, llvm

The path parameter is only read from in security_genfs_sid(),
selinux_policy_genfs_sid() and __security_genfs_sid(). Since a string
literal is passed as argument, declare the parameter const.
Also align the parameter names in the declaration and definition.

Reported by clang [-Wwrite-strings]:

    security/selinux/hooks.c:553:60: error: passing 'const char [2]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
            rc = security_genfs_sid(&selinux_state, sb->s_type->name, /,
                                                                      ^~~
    ./security/selinux/include/security.h:389:36: note: passing argument to parameter 'name' here
                           const char *fstype, char *name, u16 sclass,
                                                     ^

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 security/selinux/include/security.h | 4 ++--
 security/selinux/ss/services.c      | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h
index ac0ece01305a..6482e0efb368 100644
--- a/security/selinux/include/security.h
+++ b/security/selinux/include/security.h
@@ -386,11 +386,11 @@ int security_get_allow_unknown(struct selinux_state *state);
 int security_fs_use(struct selinux_state *state, struct super_block *sb);
 
 int security_genfs_sid(struct selinux_state *state,
-		       const char *fstype, char *name, u16 sclass,
+		       const char *fstype, const char *path, u16 sclass,
 		       u32 *sid);
 
 int selinux_policy_genfs_sid(struct selinux_policy *policy,
-		       const char *fstype, char *name, u16 sclass,
+		       const char *fstype, const char *path, u16 sclass,
 		       u32 *sid);
 
 #ifdef CONFIG_NETLABEL
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 8e92af7dd284..5a7df45bdab1 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2875,7 +2875,7 @@ int security_get_user_sids(struct selinux_state *state,
  */
 static inline int __security_genfs_sid(struct selinux_policy *policy,
 				       const char *fstype,
-				       char *path,
+				       const char *path,
 				       u16 orig_sclass,
 				       u32 *sid)
 {
@@ -2928,7 +2928,7 @@ static inline int __security_genfs_sid(struct selinux_policy *policy,
  */
 int security_genfs_sid(struct selinux_state *state,
 		       const char *fstype,
-		       char *path,
+		       const char *path,
 		       u16 orig_sclass,
 		       u32 *sid)
 {
@@ -2952,7 +2952,7 @@ int security_genfs_sid(struct selinux_state *state,
 
 int selinux_policy_genfs_sid(struct selinux_policy *policy,
 			const char *fstype,
-			char *path,
+			const char *path,
 			u16 orig_sclass,
 			u32 *sid)
 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-01-26 21:21 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 14:14 [PATCH 2/9] selinux: declare path parameters of _genfs_sid const Christian Göttsche
2022-01-25 14:14 ` [PATCH 3/9] selinux: declare name parameter of hash_eval const Christian Göttsche
2022-01-26 19:34   ` Paul Moore
2022-01-25 14:14 ` [PATCH 4/9] selinux: enclose macro arguments in parenthesis Christian Göttsche
2022-01-25 20:40   ` Nick Desaulniers
2022-01-26 20:16   ` Paul Moore
2022-01-25 14:14 ` [PATCH 5/9] selinux: drop cast to same type Christian Göttsche
2022-01-26 20:27   ` Paul Moore
2022-01-25 14:14 ` [PATCH 6/9] selinux: drop unused parameter of avtab_insert_node Christian Göttsche
2022-01-26 20:39   ` Paul Moore
2022-01-25 14:14 ` [PATCH 7/9] selinux: do not discard const qualifier in cast Christian Göttsche
2022-01-26 20:56   ` Paul Moore
2022-01-25 14:14 ` [PATCH 8/9] selinux: simplify cred_init_security Christian Göttsche
2022-01-26 20:58   ` Paul Moore
2022-01-25 14:14 ` [PATCH 9/9] selinux: drop unused macro Christian Göttsche
2022-01-25 22:47   ` Nick Desaulniers
2022-01-26 21:20   ` Paul Moore
2022-01-25 14:14 ` [PATCH 1/9] selinux: check return value of sel_make_avc_files Christian Göttsche
2022-01-25 19:46   ` Nick Desaulniers
2022-01-26  0:35   ` Paul Moore
2022-01-26  1:04 ` [PATCH 2/9] selinux: declare path parameters of _genfs_sid const Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).