+ kernel-profile-use-cpumask_available-to-check-for-null-cpumask.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: kernel/profile.c: use cpumask_available to check for NULL cpumask
has been added to the -mm tree.  Its filename is
     kernel-profile-use-cpumask_available-to-check-for-null-cpumask.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/kernel-profile-use-cpumask_available-to-check-for-null-cpumask.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/kernel-profile-use-cpumask_available-to-check-for-null-cpumask.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Nathan Chancellor <natechancellor@xxxxxxxxx>
Subject: kernel/profile.c: use cpumask_available to check for NULL cpumask

When building with clang + -Wtautological-pointer-compare, these instances
pop up:

kernel/profile.c:339:6: warning: comparison of array 'prof_cpu_mask' not
equal to a null pointer is always true [-Wtautological-pointer-compare]
        if (prof_cpu_mask != NULL)
            ^~~~~~~~~~~~~    ~~~~
kernel/profile.c:376:6: warning: comparison of array 'prof_cpu_mask' not
equal to a null pointer is always true [-Wtautological-pointer-compare]
        if (prof_cpu_mask != NULL)
            ^~~~~~~~~~~~~    ~~~~
kernel/profile.c:406:26: warning: comparison of array 'prof_cpu_mask'
not equal to a null pointer is always true
[-Wtautological-pointer-compare]
        if (!user_mode(regs) && prof_cpu_mask != NULL &&
                                ^~~~~~~~~~~~~    ~~~~
3 warnings generated.

This can be addressed with the cpumask_available helper, introduced in
commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") to fix
warnings like this while keeping the code the same.

Link: https://github.com/ClangBuiltLinux/linux/issues/747
Link: http://lkml.kernel.org/r/20191022191957.9554-1-natechancellor@xxxxxxxxx
Signed-off-by: Nathan Chancellor <natechancellor@xxxxxxxxx>
Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 kernel/profile.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/kernel/profile.c~kernel-profile-use-cpumask_available-to-check-for-null-cpumask
+++ a/kernel/profile.c
@@ -336,7 +336,7 @@ static int profile_dead_cpu(unsigned int
 	struct page *page;
 	int i;
 
-	if (prof_cpu_mask != NULL)
+	if (cpumask_available(prof_cpu_mask))
 		cpumask_clear_cpu(cpu, prof_cpu_mask);
 
 	for (i = 0; i < 2; i++) {
@@ -373,7 +373,7 @@ static int profile_prepare_cpu(unsigned
 
 static int profile_online_cpu(unsigned int cpu)
 {
-	if (prof_cpu_mask != NULL)
+	if (cpumask_available(prof_cpu_mask))
 		cpumask_set_cpu(cpu, prof_cpu_mask);
 
 	return 0;
@@ -403,7 +403,7 @@ void profile_tick(int type)
 {
 	struct pt_regs *regs = get_irq_regs();
 
-	if (!user_mode(regs) && prof_cpu_mask != NULL &&
+	if (!user_mode(regs) && cpumask_available(prof_cpu_mask) &&
 	    cpumask_test_cpu(smp_processor_id(), prof_cpu_mask))
 		profile_hit(type, (void *)profile_pc(regs));
 }
_

Patches currently in -mm which might be from natechancellor@xxxxxxxxx are

kernel-profile-use-cpumask_available-to-check-for-null-cpumask.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux