SELinux Archive mirror
 help / color / mirror / Atom feed
* [PATCH] selinux: avoid printk_ratelimit()
@ 2024-04-05 15:15 Christian Göttsche
  2024-04-30 22:08 ` Paul Moore
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Göttsche @ 2024-04-05 15:15 UTC (permalink / raw
  To: selinux; +Cc: Christian Göttsche

From: Christian Göttsche <cgzones@googlemail.com>

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>
---
 security/selinux/ss/services.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index e88b1b6c4adb..f20e1968b7f7 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -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;
 	}
 
-- 
2.43.0


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

* Re: [PATCH] selinux: avoid printk_ratelimit()
  2024-04-05 15:15 [PATCH] selinux: avoid printk_ratelimit() Christian Göttsche
@ 2024-04-30 22:08 ` Paul Moore
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Moore @ 2024-04-30 22:08 UTC (permalink / raw
  To: Christian Göttsche, selinux; +Cc: Christian Göttsche

On Apr  5, 2024 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgoettsche@seltendoof.de> wrote:
> 
> 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>
> ---
>  security/selinux/ss/services.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Thanks Christian, merged into selinux/dev.

--
paul-moore.com

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

end of thread, other threads:[~2024-04-30 22:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05 15:15 [PATCH] selinux: avoid printk_ratelimit() Christian Göttsche
2024-04-30 22:08 ` 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 read-only IMAP folder(s) and NNTP newsgroup(s).