[jirislaby:devel 22/33] drivers/acpi/acpi_dbg.c:263:6: warning: comparison of distinct pointer types ('typeof (len) *' (aka 'int *') and 'typeof ((CIRC_SPACE_TO_END((crc)->head, (crc)->tail, ((1UL) << 12)))) *' (aka 'unsigned int *'))

kernel test robot
2021-12-15T20:25:19Z

tree: https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git devel
head: d61595c5423534810c1a3c0d4a88dd2fd81d750c
commit: 4671e2ec5eadf881696fad611235561e94c6be9c [22/33] circ_buf: switch macros to inlines
config: i386-randconfig-a011-20211214 (https://download.01.org/0day-ci/archive/20211216/202112160440.3ZOATMun-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dd245bab9fbb364faa1581e4f92ba3119a872fba)
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
# https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git/commit/?id=4671e2ec5eadf881696fad611235561e94c6be9c
git remote add jirislaby https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git
git fetch --no-tags jirislaby devel
git checkout 4671e2ec5eadf881696fad611235561e94c6be9c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/acpi/

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/acpi_dbg.c:263:6: warning: comparison of distinct pointer types ('typeof (len) *' (aka 'int *') and 'typeof ((CIRC_SPACE_TO_END((crc)->head, (crc)->tail, ((1UL) << 12)))) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
n = min(len, circ_space_to_end(crc));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
>> drivers/acpi/acpi_dbg.c:585:6: warning: comparison of distinct pointer types ('typeof (len) *' (aka 'int *') and 'typeof ((CIRC_CNT_TO_END((crc)->head, (crc)->tail, ((1UL) << 12)))) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
n = min(len, circ_count_to_end(crc));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
drivers/acpi/acpi_dbg.c:655:6: warning: comparison of distinct pointer types ('typeof (len) *' (aka 'int *') and 'typeof ((CIRC_SPACE_TO_END((crc)->head, (crc)->tail, ((1UL) << 12)))) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
n = min(len, circ_space_to_end(crc));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
3 warnings generated.

vim +263 drivers/acpi/acpi_dbg.c

8cfb0cdf07e2c2 Lv Zheng 2015-12-03 249
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 250 static int acpi_aml_write_kern(const char *buf, int len)
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 251 {
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 252 int ret;
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 253 struct circ_buf *crc = &acpi_aml_io.out_crc;
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 254 int n;
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 255 char *p;
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 256
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 257 ret = acpi_aml_lock_write(crc, ACPI_AML_OUT_KERN);
287980e49ffc0f Arnd Bergmann 2016-05-27 258 if (ret < 0)
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 259 return ret;
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 260 /* sync tail before inserting logs */
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 261 smp_mb();
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 262 p = &crc->buf[crc->head];
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 @263 n = min(len, circ_space_to_end(crc));
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 264 memcpy(p, buf, n);
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 265 /* sync head after inserting logs */
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 266 smp_wmb();
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 267 crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1);
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 268 acpi_aml_unlock_fifo(ACPI_AML_OUT_KERN, true);
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 269 return n;
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 270 }
8cfb0cdf07e2c2 Lv Zheng 2015-12-03 271

:::::: The code at line 263 was first introduced by commit
:::::: 8cfb0cdf07e2c260c4d1a102bfec35183907834f ACPI / debugger: Add IO interface to access debugger functionalities

:::::: TO: Lv Zheng <lv.zheng@intel.com>
:::::: CC: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

---
0-DAY CI Kernel Test Service, Intel Corporation