Re: [PATCH] ACPI: ioremap: avoid redundant rounding to OS page size

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

 



Hi Ard,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on arm64/for-next/core arm/for-next soc/for-next v5.9-rc1 next-20200817]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ard-Biesheuvel/ACPI-ioremap-avoid-redundant-rounding-to-OS-page-size/20200817-200603
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-a013-20200817 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project de71b46a519db014ce906a39f8a0e1b235ef1568)
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
        # 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@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/acpi/osl.c:341:6: warning: variable 'virt' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (map) {
               ^~~
   drivers/acpi/osl.c:371:9: note: uninitialized use occurs here
           return virt;
                  ^~~~
   drivers/acpi/osl.c:341:2: note: remove the 'if' if its condition is always false
           if (map) {
           ^~~~~~~~~~
   drivers/acpi/osl.c:326:20: note: initialize the variable 'virt' to silence this warning
           void __iomem *virt;
                             ^
                              = NULL
   1 warning generated.

# https://github.com/0day-ci/linux/commit/a34cc34917319aed90ebf9b0fbf4146666f5f75d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ard-Biesheuvel/ACPI-ioremap-avoid-redundant-rounding-to-OS-page-size/20200817-200603
git checkout a34cc34917319aed90ebf9b0fbf4146666f5f75d
vim +341 drivers/acpi/osl.c

ba242d5b1a84bc Myron Stowe         2012-01-20  308  
9d128ed17c672b Rafael J. Wysocki   2016-01-02  309  /**
9d128ed17c672b Rafael J. Wysocki   2016-01-02  310   * acpi_os_map_iomem - Get a virtual address for a given physical address range.
9d128ed17c672b Rafael J. Wysocki   2016-01-02  311   * @phys: Start of the physical address range to map.
9d128ed17c672b Rafael J. Wysocki   2016-01-02  312   * @size: Size of the physical address range to map.
9d128ed17c672b Rafael J. Wysocki   2016-01-02  313   *
9d128ed17c672b Rafael J. Wysocki   2016-01-02  314   * Look up the given physical address range in the list of existing ACPI memory
9d128ed17c672b Rafael J. Wysocki   2016-01-02  315   * mappings.  If found, get a reference to it and return a pointer to it (its
9d128ed17c672b Rafael J. Wysocki   2016-01-02  316   * virtual address).  If not found, map it, add it to that list and return a
9d128ed17c672b Rafael J. Wysocki   2016-01-02  317   * pointer to it.
9d128ed17c672b Rafael J. Wysocki   2016-01-02  318   *
8d3523fb3b7274 Lv Zheng            2016-12-14  319   * During early init (when acpi_permanent_mmap has not been set yet) this
9d128ed17c672b Rafael J. Wysocki   2016-01-02  320   * routine simply calls __acpi_map_table() to get the job done.
9d128ed17c672b Rafael J. Wysocki   2016-01-02  321   */
9fe51603d95341 Qian Cai            2019-06-03  322  void __iomem __ref
9fe51603d95341 Qian Cai            2019-06-03  323  *acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
^1da177e4c3f41 Linus Torvalds      2005-04-16  324  {
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  325  	struct acpi_ioremap *map;
620242ae8c3d9c Myron Stowe         2010-10-21  326  	void __iomem *virt;
2d6d9fd3a54a28 Rafael J. Wysocki   2011-01-19  327  	acpi_physical_address pg_off;
2d6d9fd3a54a28 Rafael J. Wysocki   2011-01-19  328  	acpi_size pg_sz;
620242ae8c3d9c Myron Stowe         2010-10-21  329  
^1da177e4c3f41 Linus Torvalds      2005-04-16  330  	if (phys > ULONG_MAX) {
^1da177e4c3f41 Linus Torvalds      2005-04-16  331  		printk(KERN_ERR PREFIX "Cannot map memory that high\n");
70c0846e430881 Randy Dunlap        2007-02-13  332  		return NULL;
^1da177e4c3f41 Linus Torvalds      2005-04-16  333  	}
620242ae8c3d9c Myron Stowe         2010-10-21  334  
8d3523fb3b7274 Lv Zheng            2016-12-14  335  	if (!acpi_permanent_mmap)
ad71860a17ba33 Alexey Starikovskiy 2007-02-02  336  		return __acpi_map_table((unsigned long)phys, size);
620242ae8c3d9c Myron Stowe         2010-10-21  337  
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  338  	mutex_lock(&acpi_ioremap_lock);
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  339  	/* Check if there's a suitable mapping already. */
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  340  	map = acpi_map_lookup(phys, size);
7ffd0443f25024 Rafael J. Wysocki   2011-02-08 @341  	if (map) {
1757659d022b73 Rafael J. Wysocki   2020-07-02  342  		map->track.refcount++;
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  343  		goto out;
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  344  	}
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  345  
620242ae8c3d9c Myron Stowe         2010-10-21  346  	map = kzalloc(sizeof(*map), GFP_KERNEL);
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  347  	if (!map) {
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  348  		mutex_unlock(&acpi_ioremap_lock);
620242ae8c3d9c Myron Stowe         2010-10-21  349  		return NULL;
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  350  	}
620242ae8c3d9c Myron Stowe         2010-10-21  351  
4a3cba5e72a523 Myron Stowe         2010-10-21  352  	pg_off = round_down(phys, PAGE_SIZE);
4a3cba5e72a523 Myron Stowe         2010-10-21  353  	pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
a34cc34917319a Ard Biesheuvel      2020-08-17  354  	virt = acpi_map(phys, size);
620242ae8c3d9c Myron Stowe         2010-10-21  355  	if (!virt) {
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  356  		mutex_unlock(&acpi_ioremap_lock);
620242ae8c3d9c Myron Stowe         2010-10-21  357  		kfree(map);
620242ae8c3d9c Myron Stowe         2010-10-21  358  		return NULL;
620242ae8c3d9c Myron Stowe         2010-10-21  359  	}
620242ae8c3d9c Myron Stowe         2010-10-21  360  
620242ae8c3d9c Myron Stowe         2010-10-21  361  	INIT_LIST_HEAD(&map->list);
a34cc34917319a Ard Biesheuvel      2020-08-17  362  	map->virt = (void *)((unsigned long)virt & PAGE_MASK);
4a3cba5e72a523 Myron Stowe         2010-10-21  363  	map->phys = pg_off;
4a3cba5e72a523 Myron Stowe         2010-10-21  364  	map->size = pg_sz;
1757659d022b73 Rafael J. Wysocki   2020-07-02  365  	map->track.refcount = 1;
620242ae8c3d9c Myron Stowe         2010-10-21  366  
78cdb3ed405379 Myron Stowe         2010-10-21  367  	list_add_tail_rcu(&map->list, &acpi_ioremaps);
620242ae8c3d9c Myron Stowe         2010-10-21  368  
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  369  out:
7ffd0443f25024 Rafael J. Wysocki   2011-02-08  370  	mutex_unlock(&acpi_ioremap_lock);
a34cc34917319a Ard Biesheuvel      2020-08-17  371  	return virt;
^1da177e4c3f41 Linus Torvalds      2005-04-16  372  }
a238317ce81855 Lv Zheng            2014-05-20  373  EXPORT_SYMBOL_GPL(acpi_os_map_iomem);
a238317ce81855 Lv Zheng            2014-05-20  374  

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux