selinux: declare path parameters of _genfs_sid const
authorChristian Göttsche <cgzones@googlemail.com>
Tue, 25 Jan 2022 14:14:12 +0000 (15:14 +0100)
committerPaul Moore <paul@paul-moore.com>
Wed, 26 Jan 2022 00:59:52 +0000 (19:59 -0500)
commit08df49054f311ca04954cf24d1216d3b5ddfd0a6
tree6a4b006a8f24d5c90350ce3cff71be7bd0bd3a36
parentbcb62828e3e8c813b6613db6eb7fd9657db248fc
selinux: declare path parameters of _genfs_sid const

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, ... , /,
                                                          ^~~
    ./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>
[PM: wrapped description]
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/include/security.h
security/selinux/ss/services.c