selinux: avoid printk_ratelimit()
authorChristian Göttsche <cgzones@googlemail.com>
Fri, 5 Apr 2024 15:15:23 +0000 (17:15 +0200)
committerPaul Moore <paul@paul-moore.com>
Tue, 30 Apr 2024 23:01:04 +0000 (19:01 -0400)
The usage of printk_ratelimit() is discouraged, see
include/linux/printk.h, thus use pr_warn_ratelimited().

While editing this line address the following checkpatch warning:

    WARNING: Integer promotion: Using 'h' in '%hu' is unnecessary

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/ss/services.c

index e88b1b6c4adbb2d59c64407cc73fb36af2e6a72a..f20e1968b7f7a848661e79652d453d12e5e63dbf 100644 (file)
@@ -633,8 +633,7 @@ static void context_struct_compute_av(struct policydb *policydb,
        }
 
        if (unlikely(!tclass || tclass > policydb->p_classes.nprim)) {
-               if (printk_ratelimit())
-                       pr_warn("SELinux:  Invalid class %hu\n", tclass);
+               pr_warn_ratelimited("SELinux:  Invalid class %u\n", tclass);
                return;
        }