All of lore.kernel.org
 help / color / mirror / Atom feed
* [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
@ 2020-12-27  5:11 ` kernel test robot
  0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2020-12-27  5:11 UTC (permalink / raw)
  To: Mark Pearson
  Cc: kbuild-all, clang-built-linux, linux-acpi, devel, linux-pm,
	Rafael J. Wysocki, Hans de Goede

[-- Attachment #1: Type: text/plain, Size: 2644 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head:   a33520709645543f108361fe21fa9434a351c4e9
commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
config: x86_64-randconfig-a015-20201221 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
        git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
        git fetch --no-tags pm bleeding-edge
        git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
           if (!pprof || !pprof->choices || !pprof->profile_set ||
                         ~~~~~~~~^~~~~~~
   1 warning generated.


vim +147 drivers/acpi/platform_profile.c

   134	
   135	int platform_profile_register(const struct platform_profile_handler *pprof)
   136	{
   137		int err;
   138	
   139		mutex_lock(&profile_lock);
   140		/* We can only have one active profile */
   141		if (cur_profile) {
   142			mutex_unlock(&profile_lock);
   143			return -EEXIST;
   144		}
   145	
   146		/* Sanity check the profile handler field are set */
 > 147		if (!pprof || !pprof->choices || !pprof->profile_set ||
   148				!pprof->profile_get) {
   149			mutex_unlock(&profile_lock);
   150			return -EINVAL;
   151		}
   152	
   153		err = sysfs_create_group(acpi_kobj, &platform_profile_group);
   154		if (err) {
   155			mutex_unlock(&profile_lock);
   156			return err;
   157		}
   158	
   159		cur_profile = pprof;
   160		mutex_unlock(&profile_lock);
   161		return 0;
   162	}
   163	EXPORT_SYMBOL_GPL(platform_profile_register);
   164	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35796 bytes --]

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

* [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
@ 2020-12-27  5:11 ` kernel test robot
  0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2020-12-27  5:11 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2711 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head:   a33520709645543f108361fe21fa9434a351c4e9
commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
config: x86_64-randconfig-a015-20201221 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
        git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
        git fetch --no-tags pm bleeding-edge
        git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
           if (!pprof || !pprof->choices || !pprof->profile_set ||
                         ~~~~~~~~^~~~~~~
   1 warning generated.


vim +147 drivers/acpi/platform_profile.c

   134	
   135	int platform_profile_register(const struct platform_profile_handler *pprof)
   136	{
   137		int err;
   138	
   139		mutex_lock(&profile_lock);
   140		/* We can only have one active profile */
   141		if (cur_profile) {
   142			mutex_unlock(&profile_lock);
   143			return -EEXIST;
   144		}
   145	
   146		/* Sanity check the profile handler field are set */
 > 147		if (!pprof || !pprof->choices || !pprof->profile_set ||
   148				!pprof->profile_get) {
   149			mutex_unlock(&profile_lock);
   150			return -EINVAL;
   151		}
   152	
   153		err = sysfs_create_group(acpi_kobj, &platform_profile_group);
   154		if (err) {
   155			mutex_unlock(&profile_lock);
   156			return err;
   157		}
   158	
   159		cur_profile = pprof;
   160		mutex_unlock(&profile_lock);
   161		return 0;
   162	}
   163	EXPORT_SYMBOL_GPL(platform_profile_register);
   164	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35796 bytes --]

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

* [Devel] [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
@ 2020-12-27  5:11 ` kernel test robot
  0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2020-12-27  5:11 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 2713 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head:   a33520709645543f108361fe21fa9434a351c4e9
commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
config: x86_64-randconfig-a015-20201221 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
        git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
        git fetch --no-tags pm bleeding-edge
        git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>

All warnings (new ones prefixed by >>):

>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
           if (!pprof || !pprof->choices || !pprof->profile_set ||
                         ~~~~~~~~^~~~~~~
   1 warning generated.


vim +147 drivers/acpi/platform_profile.c

   134	
   135	int platform_profile_register(const struct platform_profile_handler *pprof)
   136	{
   137		int err;
   138	
   139		mutex_lock(&profile_lock);
   140		/* We can only have one active profile */
   141		if (cur_profile) {
   142			mutex_unlock(&profile_lock);
   143			return -EEXIST;
   144		}
   145	
   146		/* Sanity check the profile handler field are set */
 > 147		if (!pprof || !pprof->choices || !pprof->profile_set ||
   148				!pprof->profile_get) {
   149			mutex_unlock(&profile_lock);
   150			return -EINVAL;
   151		}
   152	
   153		err = sysfs_create_group(acpi_kobj, &platform_profile_group);
   154		if (err) {
   155			mutex_unlock(&profile_lock);
   156			return err;
   157		}
   158	
   159		cur_profile = pprof;
   160		mutex_unlock(&profile_lock);
   161		return 0;
   162	}
   163	EXPORT_SYMBOL_GPL(platform_profile_register);
   164	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35796 bytes --]

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

* Re: [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
  2020-12-27  5:11 ` kernel test robot
@ 2020-12-27 11:56   ` Hans de Goede
  -1 siblings, 0 replies; 13+ messages in thread
From: Hans de Goede @ 2020-12-27 11:56 UTC (permalink / raw)
  To: kernel test robot, Mark Pearson
  Cc: kbuild-all, clang-built-linux, linux-acpi, devel, linux-pm,
	Rafael J. Wysocki

Hi,

On 12/27/20 6:11 AM, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
> head:   a33520709645543f108361fe21fa9434a351c4e9
> commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
> config: x86_64-randconfig-a015-20201221 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install x86_64 cross compiling tool for clang build
>         # apt-get install binutils-x86-64-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
>         git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
>         git fetch --no-tags pm bleeding-edge
>         git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
>            if (!pprof || !pprof->choices || !pprof->profile_set ||
>                          ~~~~~~~~^~~~~~~
>    1 warning generated.


Ah, this is caused by changing choices from a single long to:

	unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];

So that we can use for_each_set_bit and are future proof for more then
32 profiles.

To fix this the check should be changed into this (untested):

#include <linux/bitmap.h>

	if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
	    !pprof->profile_set || !pprof->profile_get) {
		mutex_unlock(&profile_lock);
		return -EINVAL;
	}

Mark can you provide a (tested) patch for this?

Regards,

Hans








> 
> 
> vim +147 drivers/acpi/platform_profile.c
> 
>    134	
>    135	int platform_profile_register(const struct platform_profile_handler *pprof)
>    136	{
>    137		int err;
>    138	
>    139		mutex_lock(&profile_lock);
>    140		/* We can only have one active profile */
>    141		if (cur_profile) {
>    142			mutex_unlock(&profile_lock);
>    143			return -EEXIST;
>    144		}
>    145	
>    146		/* Sanity check the profile handler field are set */
>  > 147		if (!pprof || !pprof->choices || !pprof->profile_set ||
>    148				!pprof->profile_get) {
>    149			mutex_unlock(&profile_lock);
>    150			return -EINVAL;
>    151		}
>    152	
>    153		err = sysfs_create_group(acpi_kobj, &platform_profile_group);
>    154		if (err) {
>    155			mutex_unlock(&profile_lock);
>    156			return err;
>    157		}
>    158	
>    159		cur_profile = pprof;
>    160		mutex_unlock(&profile_lock);
>    161		return 0;
>    162	}
>    163	EXPORT_SYMBOL_GPL(platform_profile_register);
>    164	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> 


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

* Re: [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
@ 2020-12-27 11:56   ` Hans de Goede
  0 siblings, 0 replies; 13+ messages in thread
From: Hans de Goede @ 2020-12-27 11:56 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3479 bytes --]

Hi,

On 12/27/20 6:11 AM, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
> head:   a33520709645543f108361fe21fa9434a351c4e9
> commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
> config: x86_64-randconfig-a015-20201221 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install x86_64 cross compiling tool for clang build
>         # apt-get install binutils-x86-64-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
>         git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
>         git fetch --no-tags pm bleeding-edge
>         git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
>            if (!pprof || !pprof->choices || !pprof->profile_set ||
>                          ~~~~~~~~^~~~~~~
>    1 warning generated.


Ah, this is caused by changing choices from a single long to:

	unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];

So that we can use for_each_set_bit and are future proof for more then
32 profiles.

To fix this the check should be changed into this (untested):

#include <linux/bitmap.h>

	if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
	    !pprof->profile_set || !pprof->profile_get) {
		mutex_unlock(&profile_lock);
		return -EINVAL;
	}

Mark can you provide a (tested) patch for this?

Regards,

Hans








> 
> 
> vim +147 drivers/acpi/platform_profile.c
> 
>    134	
>    135	int platform_profile_register(const struct platform_profile_handler *pprof)
>    136	{
>    137		int err;
>    138	
>    139		mutex_lock(&profile_lock);
>    140		/* We can only have one active profile */
>    141		if (cur_profile) {
>    142			mutex_unlock(&profile_lock);
>    143			return -EEXIST;
>    144		}
>    145	
>    146		/* Sanity check the profile handler field are set */
>  > 147		if (!pprof || !pprof->choices || !pprof->profile_set ||
>    148				!pprof->profile_get) {
>    149			mutex_unlock(&profile_lock);
>    150			return -EINVAL;
>    151		}
>    152	
>    153		err = sysfs_create_group(acpi_kobj, &platform_profile_group);
>    154		if (err) {
>    155			mutex_unlock(&profile_lock);
>    156			return err;
>    157		}
>    158	
>    159		cur_profile = pprof;
>    160		mutex_unlock(&profile_lock);
>    161		return 0;
>    162	}
>    163	EXPORT_SYMBOL_GPL(platform_profile_register);
>    164	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
> 

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

* Re: [External] Re: [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
  2020-12-27 11:56   ` Hans de Goede
  (?)
@ 2020-12-28 23:12   ` Mark Pearson
  2020-12-29 15:23       ` Rafael J. Wysocki
  -1 siblings, 1 reply; 13+ messages in thread
From: Mark Pearson @ 2020-12-28 23:12 UTC (permalink / raw)
  To: Hans de Goede, kernel test robot
  Cc: kbuild-all, clang-built-linux, linux-acpi, devel, linux-pm,
	Rafael J. Wysocki

Hi Hans

On 27/12/2020 06:56, Hans de Goede wrote:
> Hi,
> 
> On 12/27/20 6:11 AM, kernel test robot wrote:
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
>> head:   a33520709645543f108361fe21fa9434a351c4e9
>> commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
>> config: x86_64-randconfig-a015-20201221 (attached as .config)
>> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
>> reproduce (this is a W=1 build):
>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # install x86_64 cross compiling tool for clang build
>>         # apt-get install binutils-x86-64-linux-gnu
>>         # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
>>         git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
>>         git fetch --no-tags pm bleeding-edge
>>         git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
>>         # save the attached .config to linux build tree
>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> All warnings (new ones prefixed by >>):
>>
>>>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
>>            if (!pprof || !pprof->choices || !pprof->profile_set ||
>>                          ~~~~~~~~^~~~~~~
>>    1 warning generated.
> 
> 
> Ah, this is caused by changing choices from a single long to:
> 
> 	unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
> 
> So that we can use for_each_set_bit and are future proof for more then
> 32 profiles.
> 
> To fix this the check should be changed into this (untested):
> 
> #include <linux/bitmap.h>
> 
> 	if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
> 	    !pprof->profile_set || !pprof->profile_get) {
> 		mutex_unlock(&profile_lock);
> 		return -EINVAL;
> 	}
> 
> Mark can you provide a (tested) patch for this?
> 
> Regards,
> 
> Hans
> 
Will do!

Mark

> 
> 
> 
> 
> 
> 
> 
>>
>>
>> vim +147 drivers/acpi/platform_profile.c
>>
>>    134	
>>    135	int platform_profile_register(const struct platform_profile_handler *pprof)
>>    136	{
>>    137		int err;
>>    138	
>>    139		mutex_lock(&profile_lock);
>>    140		/* We can only have one active profile */
>>    141		if (cur_profile) {
>>    142			mutex_unlock(&profile_lock);
>>    143			return -EEXIST;
>>    144		}
>>    145	
>>    146		/* Sanity check the profile handler field are set */
>>  > 147		if (!pprof || !pprof->choices || !pprof->profile_set ||
>>    148				!pprof->profile_get) {
>>    149			mutex_unlock(&profile_lock);
>>    150			return -EINVAL;
>>    151		}
>>    152	
>>    153		err = sysfs_create_group(acpi_kobj, &platform_profile_group);
>>    154		if (err) {
>>    155			mutex_unlock(&profile_lock);
>>    156			return err;
>>    157		}
>>    158	
>>    159		cur_profile = pprof;
>>    160		mutex_unlock(&profile_lock);
>>    161		return 0;
>>    162	}
>>    163	EXPORT_SYMBOL_GPL(platform_profile_register);
>>    164	
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>>
> 

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

* Re: [External] Re: [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
  2020-12-28 23:12   ` [External] " Mark Pearson
  2020-12-29 15:23       ` Rafael J. Wysocki
@ 2020-12-29 15:23       ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2020-12-29 15:23 UTC (permalink / raw)
  To: Mark Pearson
  Cc: Hans de Goede, kernel test robot, kbuild-all, clang-built-linux,
	ACPI Devel Maling List,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Linux PM, Rafael J. Wysocki

On Tue, Dec 29, 2020 at 12:18 AM Mark Pearson <markpearson@lenovo.com> wrote:
>
> Hi Hans
>
> On 27/12/2020 06:56, Hans de Goede wrote:
> > Hi,
> >
> > On 12/27/20 6:11 AM, kernel test robot wrote:
> >> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
> >> head:   a33520709645543f108361fe21fa9434a351c4e9
> >> commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
> >> config: x86_64-randconfig-a015-20201221 (attached as .config)
> >> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
> >> reproduce (this is a W=1 build):
> >>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >>         chmod +x ~/bin/make.cross
> >>         # install x86_64 cross compiling tool for clang build
> >>         # apt-get install binutils-x86-64-linux-gnu
> >>         # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>         git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
> >>         git fetch --no-tags pm bleeding-edge
> >>         git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>         # save the attached .config to linux build tree
> >>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> >>
> >> If you fix the issue, kindly add following tag as appropriate
> >> Reported-by: kernel test robot <lkp@intel.com>
> >>
> >> All warnings (new ones prefixed by >>):
> >>
> >>>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
> >>            if (!pprof || !pprof->choices || !pprof->profile_set ||
> >>                          ~~~~~~~~^~~~~~~
> >>    1 warning generated.
> >
> >
> > Ah, this is caused by changing choices from a single long to:
> >
> >       unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
> >
> > So that we can use for_each_set_bit and are future proof for more then
> > 32 profiles.
> >
> > To fix this the check should be changed into this (untested):
> >
> > #include <linux/bitmap.h>
> >
> >       if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
> >           !pprof->profile_set || !pprof->profile_get) {
> >               mutex_unlock(&profile_lock);
> >               return -EINVAL;
> >       }
> >
> > Mark can you provide a (tested) patch for this?
> >
> > Regards,
> >
> > Hans
> >
> Will do!

Please note that I'm not going to push the material to Linus with this
warning, so if you want it to go into 5.11, that needs to be addressed
timely.

Thanks!

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

* Re: [External] Re: [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
@ 2020-12-29 15:23       ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2020-12-29 15:23 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2842 bytes --]

On Tue, Dec 29, 2020 at 12:18 AM Mark Pearson <markpearson@lenovo.com> wrote:
>
> Hi Hans
>
> On 27/12/2020 06:56, Hans de Goede wrote:
> > Hi,
> >
> > On 12/27/20 6:11 AM, kernel test robot wrote:
> >> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
> >> head:   a33520709645543f108361fe21fa9434a351c4e9
> >> commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
> >> config: x86_64-randconfig-a015-20201221 (attached as .config)
> >> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
> >> reproduce (this is a W=1 build):
> >>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >>         chmod +x ~/bin/make.cross
> >>         # install x86_64 cross compiling tool for clang build
> >>         # apt-get install binutils-x86-64-linux-gnu
> >>         # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>         git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
> >>         git fetch --no-tags pm bleeding-edge
> >>         git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>         # save the attached .config to linux build tree
> >>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> >>
> >> If you fix the issue, kindly add following tag as appropriate
> >> Reported-by: kernel test robot <lkp@intel.com>
> >>
> >> All warnings (new ones prefixed by >>):
> >>
> >>>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
> >>            if (!pprof || !pprof->choices || !pprof->profile_set ||
> >>                          ~~~~~~~~^~~~~~~
> >>    1 warning generated.
> >
> >
> > Ah, this is caused by changing choices from a single long to:
> >
> >       unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
> >
> > So that we can use for_each_set_bit and are future proof for more then
> > 32 profiles.
> >
> > To fix this the check should be changed into this (untested):
> >
> > #include <linux/bitmap.h>
> >
> >       if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
> >           !pprof->profile_set || !pprof->profile_get) {
> >               mutex_unlock(&profile_lock);
> >               return -EINVAL;
> >       }
> >
> > Mark can you provide a (tested) patch for this?
> >
> > Regards,
> >
> > Hans
> >
> Will do!

Please note that I'm not going to push the material to Linus with this
warning, so if you want it to go into 5.11, that needs to be addressed
timely.

Thanks!

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

* [Devel] Re: [External] Re: [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
@ 2020-12-29 15:23       ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2020-12-29 15:23 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 2846 bytes --]

On Tue, Dec 29, 2020 at 12:18 AM Mark Pearson <markpearson(a)lenovo.com> wrote:
>
> Hi Hans
>
> On 27/12/2020 06:56, Hans de Goede wrote:
> > Hi,
> >
> > On 12/27/20 6:11 AM, kernel test robot wrote:
> >> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
> >> head:   a33520709645543f108361fe21fa9434a351c4e9
> >> commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
> >> config: x86_64-randconfig-a015-20201221 (attached as .config)
> >> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
> >> reproduce (this is a W=1 build):
> >>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >>         chmod +x ~/bin/make.cross
> >>         # install x86_64 cross compiling tool for clang build
> >>         # apt-get install binutils-x86-64-linux-gnu
> >>         # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>         git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
> >>         git fetch --no-tags pm bleeding-edge
> >>         git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>         # save the attached .config to linux build tree
> >>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> >>
> >> If you fix the issue, kindly add following tag as appropriate
> >> Reported-by: kernel test robot <lkp(a)intel.com>
> >>
> >> All warnings (new ones prefixed by >>):
> >>
> >>>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
> >>            if (!pprof || !pprof->choices || !pprof->profile_set ||
> >>                          ~~~~~~~~^~~~~~~
> >>    1 warning generated.
> >
> >
> > Ah, this is caused by changing choices from a single long to:
> >
> >       unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
> >
> > So that we can use for_each_set_bit and are future proof for more then
> > 32 profiles.
> >
> > To fix this the check should be changed into this (untested):
> >
> > #include <linux/bitmap.h>
> >
> >       if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
> >           !pprof->profile_set || !pprof->profile_get) {
> >               mutex_unlock(&profile_lock);
> >               return -EINVAL;
> >       }
> >
> > Mark can you provide a (tested) patch for this?
> >
> > Regards,
> >
> > Hans
> >
> Will do!

Please note that I'm not going to push the material to Linus with this
warning, so if you want it to go into 5.11, that needs to be addressed
timely.

Thanks!

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

* Re: [External] Re: [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
  2020-12-29 15:23       ` Rafael J. Wysocki
  (?)
  (?)
@ 2020-12-29 15:35       ` Mark Pearson
  2020-12-29 15:46           ` Rafael J. Wysocki
  -1 siblings, 1 reply; 13+ messages in thread
From: Mark Pearson @ 2020-12-29 15:35 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Hans de Goede, kernel test robot, kbuild-all, clang-built-linux,
	ACPI Devel Maling List,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Linux PM, Rafael J. Wysocki

Hi Rafael

On 29/12/2020 10:23, Rafael J. Wysocki wrote:
> On Tue, Dec 29, 2020 at 12:18 AM Mark Pearson <markpearson@lenovo.com> wrote:
>>
>> Hi Hans
>>
>> On 27/12/2020 06:56, Hans de Goede wrote:
>>> Hi,
>>>
>>> On 12/27/20 6:11 AM, kernel test robot wrote:
>>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
>>>> head:   a33520709645543f108361fe21fa9434a351c4e9
>>>> commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
>>>> config: x86_64-randconfig-a015-20201221 (attached as .config)
>>>> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
>>>> reproduce (this is a W=1 build):
>>>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>>>         chmod +x ~/bin/make.cross
>>>>         # install x86_64 cross compiling tool for clang build
>>>>         # apt-get install binutils-x86-64-linux-gnu
>>>>         # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
>>>>         git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
>>>>         git fetch --no-tags pm bleeding-edge
>>>>         git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
>>>>         # save the attached .config to linux build tree
>>>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
>>>>
>>>> If you fix the issue, kindly add following tag as appropriate
>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>>
>>>> All warnings (new ones prefixed by >>):
>>>>
>>>>>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
>>>>            if (!pprof || !pprof->choices || !pprof->profile_set ||
>>>>                          ~~~~~~~~^~~~~~~
>>>>    1 warning generated.
>>>
>>>
>>> Ah, this is caused by changing choices from a single long to:
>>>
>>>       unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
>>>
>>> So that we can use for_each_set_bit and are future proof for more then
>>> 32 profiles.
>>>
>>> To fix this the check should be changed into this (untested):
>>>
>>> #include <linux/bitmap.h>
>>>
>>>       if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
>>>           !pprof->profile_set || !pprof->profile_get) {
>>>               mutex_unlock(&profile_lock);
>>>               return -EINVAL;
>>>       }
>>>
>>> Mark can you provide a (tested) patch for this?
>>>
>>> Regards,
>>>
>>> Hans
>>>
>> Will do!
> 
> Please note that I'm not going to push the material to Linus with this
> warning, so if you want it to go into 5.11, that needs to be addressed
> timely.
> 
> Thanks!
> 
Understood :) I tested this last night and it looks good. Do I push this
as a v8 patch on the current series or as a new standalone patch?

Mark

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

* Re: [External] Re: [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
  2020-12-29 15:35       ` Mark Pearson
  2020-12-29 15:46           ` Rafael J. Wysocki
@ 2020-12-29 15:46           ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2020-12-29 15:46 UTC (permalink / raw)
  To: Mark Pearson
  Cc: Rafael J. Wysocki, Hans de Goede, kernel test robot, kbuild-all,
	clang-built-linux, ACPI Devel Maling List,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Linux PM, Rafael J. Wysocki

On Tue, Dec 29, 2020 at 4:36 PM Mark Pearson <markpearson@lenovo.com> wrote:
>
> Hi Rafael
>
> On 29/12/2020 10:23, Rafael J. Wysocki wrote:
> > On Tue, Dec 29, 2020 at 12:18 AM Mark Pearson <markpearson@lenovo.com> wrote:
> >>
> >> Hi Hans
> >>
> >> On 27/12/2020 06:56, Hans de Goede wrote:
> >>> Hi,
> >>>
> >>> On 12/27/20 6:11 AM, kernel test robot wrote:
> >>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
> >>>> head:   a33520709645543f108361fe21fa9434a351c4e9
> >>>> commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
> >>>> config: x86_64-randconfig-a015-20201221 (attached as .config)
> >>>> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
> >>>> reproduce (this is a W=1 build):
> >>>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >>>>         chmod +x ~/bin/make.cross
> >>>>         # install x86_64 cross compiling tool for clang build
> >>>>         # apt-get install binutils-x86-64-linux-gnu
> >>>>         # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>>>         git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
> >>>>         git fetch --no-tags pm bleeding-edge
> >>>>         git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>>>         # save the attached .config to linux build tree
> >>>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> >>>>
> >>>> If you fix the issue, kindly add following tag as appropriate
> >>>> Reported-by: kernel test robot <lkp@intel.com>
> >>>>
> >>>> All warnings (new ones prefixed by >>):
> >>>>
> >>>>>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
> >>>>            if (!pprof || !pprof->choices || !pprof->profile_set ||
> >>>>                          ~~~~~~~~^~~~~~~
> >>>>    1 warning generated.
> >>>
> >>>
> >>> Ah, this is caused by changing choices from a single long to:
> >>>
> >>>       unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
> >>>
> >>> So that we can use for_each_set_bit and are future proof for more then
> >>> 32 profiles.
> >>>
> >>> To fix this the check should be changed into this (untested):
> >>>
> >>> #include <linux/bitmap.h>
> >>>
> >>>       if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
> >>>           !pprof->profile_set || !pprof->profile_get) {
> >>>               mutex_unlock(&profile_lock);
> >>>               return -EINVAL;
> >>>       }
> >>>
> >>> Mark can you provide a (tested) patch for this?
> >>>
> >>> Regards,
> >>>
> >>> Hans
> >>>
> >> Will do!
> >
> > Please note that I'm not going to push the material to Linus with this
> > warning, so if you want it to go into 5.11, that needs to be addressed
> > timely.
> >
> > Thanks!
> >
> Understood :) I tested this last night and it looks good. Do I push this
> as a v8 patch on the current series or as a new standalone patch?

An incremental patch to fix the issue, please.

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

* Re: [External] Re: [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
@ 2020-12-29 15:46           ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2020-12-29 15:46 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3337 bytes --]

On Tue, Dec 29, 2020 at 4:36 PM Mark Pearson <markpearson@lenovo.com> wrote:
>
> Hi Rafael
>
> On 29/12/2020 10:23, Rafael J. Wysocki wrote:
> > On Tue, Dec 29, 2020 at 12:18 AM Mark Pearson <markpearson@lenovo.com> wrote:
> >>
> >> Hi Hans
> >>
> >> On 27/12/2020 06:56, Hans de Goede wrote:
> >>> Hi,
> >>>
> >>> On 12/27/20 6:11 AM, kernel test robot wrote:
> >>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
> >>>> head:   a33520709645543f108361fe21fa9434a351c4e9
> >>>> commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
> >>>> config: x86_64-randconfig-a015-20201221 (attached as .config)
> >>>> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
> >>>> reproduce (this is a W=1 build):
> >>>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >>>>         chmod +x ~/bin/make.cross
> >>>>         # install x86_64 cross compiling tool for clang build
> >>>>         # apt-get install binutils-x86-64-linux-gnu
> >>>>         # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>>>         git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
> >>>>         git fetch --no-tags pm bleeding-edge
> >>>>         git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>>>         # save the attached .config to linux build tree
> >>>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> >>>>
> >>>> If you fix the issue, kindly add following tag as appropriate
> >>>> Reported-by: kernel test robot <lkp@intel.com>
> >>>>
> >>>> All warnings (new ones prefixed by >>):
> >>>>
> >>>>>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
> >>>>            if (!pprof || !pprof->choices || !pprof->profile_set ||
> >>>>                          ~~~~~~~~^~~~~~~
> >>>>    1 warning generated.
> >>>
> >>>
> >>> Ah, this is caused by changing choices from a single long to:
> >>>
> >>>       unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
> >>>
> >>> So that we can use for_each_set_bit and are future proof for more then
> >>> 32 profiles.
> >>>
> >>> To fix this the check should be changed into this (untested):
> >>>
> >>> #include <linux/bitmap.h>
> >>>
> >>>       if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
> >>>           !pprof->profile_set || !pprof->profile_get) {
> >>>               mutex_unlock(&profile_lock);
> >>>               return -EINVAL;
> >>>       }
> >>>
> >>> Mark can you provide a (tested) patch for this?
> >>>
> >>> Regards,
> >>>
> >>> Hans
> >>>
> >> Will do!
> >
> > Please note that I'm not going to push the material to Linus with this
> > warning, so if you want it to go into 5.11, that needs to be addressed
> > timely.
> >
> > Thanks!
> >
> Understood :) I tested this last night and it looks good. Do I push this
> as a v8 patch on the current series or as a new standalone patch?

An incremental patch to fix the issue, please.

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

* [Devel] Re: [External] Re: [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true'
@ 2020-12-29 15:46           ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2020-12-29 15:46 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 3343 bytes --]

On Tue, Dec 29, 2020 at 4:36 PM Mark Pearson <markpearson(a)lenovo.com> wrote:
>
> Hi Rafael
>
> On 29/12/2020 10:23, Rafael J. Wysocki wrote:
> > On Tue, Dec 29, 2020 at 12:18 AM Mark Pearson <markpearson(a)lenovo.com> wrote:
> >>
> >> Hi Hans
> >>
> >> On 27/12/2020 06:56, Hans de Goede wrote:
> >>> Hi,
> >>>
> >>> On 12/27/20 6:11 AM, kernel test robot wrote:
> >>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
> >>>> head:   a33520709645543f108361fe21fa9434a351c4e9
> >>>> commit: 8c9b909fb1282e43792433e6c1cba125ccfc6201 [8612/8615] ACPI: platform-profile: Add platform profile support
> >>>> config: x86_64-randconfig-a015-20201221 (attached as .config)
> >>>> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
> >>>> reproduce (this is a W=1 build):
> >>>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >>>>         chmod +x ~/bin/make.cross
> >>>>         # install x86_64 cross compiling tool for clang build
> >>>>         # apt-get install binutils-x86-64-linux-gnu
> >>>>         # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>>>         git remote add pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
> >>>>         git fetch --no-tags pm bleeding-edge
> >>>>         git checkout 8c9b909fb1282e43792433e6c1cba125ccfc6201
> >>>>         # save the attached .config to linux build tree
> >>>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> >>>>
> >>>> If you fix the issue, kindly add following tag as appropriate
> >>>> Reported-by: kernel test robot <lkp(a)intel.com>
> >>>>
> >>>> All warnings (new ones prefixed by >>):
> >>>>
> >>>>>> drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' [-Wpointer-bool-conversion]
> >>>>            if (!pprof || !pprof->choices || !pprof->profile_set ||
> >>>>                          ~~~~~~~~^~~~~~~
> >>>>    1 warning generated.
> >>>
> >>>
> >>> Ah, this is caused by changing choices from a single long to:
> >>>
> >>>       unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
> >>>
> >>> So that we can use for_each_set_bit and are future proof for more then
> >>> 32 profiles.
> >>>
> >>> To fix this the check should be changed into this (untested):
> >>>
> >>> #include <linux/bitmap.h>
> >>>
> >>>       if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
> >>>           !pprof->profile_set || !pprof->profile_get) {
> >>>               mutex_unlock(&profile_lock);
> >>>               return -EINVAL;
> >>>       }
> >>>
> >>> Mark can you provide a (tested) patch for this?
> >>>
> >>> Regards,
> >>>
> >>> Hans
> >>>
> >> Will do!
> >
> > Please note that I'm not going to push the material to Linus with this
> > warning, so if you want it to go into 5.11, that needs to be addressed
> > timely.
> >
> > Thanks!
> >
> Understood :) I tested this last night and it looks good. Do I push this
> as a v8 patch on the current series or as a new standalone patch?

An incremental patch to fix the issue, please.

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

end of thread, other threads:[~2020-12-29 15:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-27  5:11 [pm:bleeding-edge 8612/8615] drivers/acpi/platform_profile.c:147:24: warning: address of array 'pprof->choices' will always evaluate to 'true' kernel test robot
2020-12-27  5:11 ` [Devel] " kernel test robot
2020-12-27  5:11 ` kernel test robot
2020-12-27 11:56 ` Hans de Goede
2020-12-27 11:56   ` Hans de Goede
2020-12-28 23:12   ` [External] " Mark Pearson
2020-12-29 15:23     ` Rafael J. Wysocki
2020-12-29 15:23       ` [Devel] " Rafael J. Wysocki
2020-12-29 15:23       ` Rafael J. Wysocki
2020-12-29 15:35       ` Mark Pearson
2020-12-29 15:46         ` Rafael J. Wysocki
2020-12-29 15:46           ` [Devel] " Rafael J. Wysocki
2020-12-29 15:46           ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.