[asahilinux:asc/dev 6/6] drivers/mailbox/apple-asc-mailbox.c:258:4: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'dma_addr_t' {aka 'unsigned int'}

From: kernel test robot
Date: Thu Jul 29 2021 - 19:36:53 EST


tree: https://github.com/AsahiLinux/linux asc/dev
head: 907486d12637dc27e339f7084dc78aeaf323479f
commit: 907486d12637dc27e339f7084dc78aeaf323479f [6/6] mailbox WIP
config: i386-allyesconfig (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce (this is a W=1 build):
# https://github.com/AsahiLinux/linux/commit/907486d12637dc27e339f7084dc78aeaf323479f
git remote add asahilinux https://github.com/AsahiLinux/linux
git fetch --no-tags asahilinux asc/dev
git checkout 907486d12637dc27e339f7084dc78aeaf323479f
# save the attached .config to linux build tree
make W=1 ARCH=i386

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

All warnings (new ones prefixed by >>):

| ^~~~~~~~~~~~~~~~
include/linux/build_bug.h:21:2: note: in expansion of macro 'BUILD_BUG_ON'
21 | BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
| ^~~~~~~~~~~~
include/linux/bitfield.h:54:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
54 | __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:108:3: note: in expansion of macro '__BF_FIELD_CHECK'
108 | __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
| ^~~~~~~~~~~~~~~~
drivers/mailbox/apple-asc-mailbox.c:242:17: note: in expansion of macro 'FIELD_GET'
242 | buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg);
| ^~~~~~~~~
include/linux/bits.h:38:31: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/mailbox/apple-asc-mailbox.h:84:41: note: in expansion of macro 'GENMASK'
84 | #define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(39, 0)
| ^~~~~~~
drivers/mailbox/apple-asc-mailbox.c:242:27: note: in expansion of macro 'APPLE_RTKIT_BUFFER_REQUEST_IOVA'
242 | buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bits.h:36:11: warning: right shift count is negative [-Wshift-count-negative]
36 | (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
| ^~
include/linux/compiler_types.h:308:9: note: in definition of macro '__compiletime_assert'
308 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:328:2: note: in expansion of macro '_compiletime_assert'
328 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/linux/build_bug.h:21:2: note: in expansion of macro 'BUILD_BUG_ON'
21 | BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
| ^~~~~~~~~~~~
include/linux/bitfield.h:54:3: note: in expansion of macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
54 | __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:55:21: note: in expansion of macro '__bf_shf'
55 | (1ULL << __bf_shf(_mask))); \
| ^~~~~~~~
include/linux/bitfield.h:108:3: note: in expansion of macro '__BF_FIELD_CHECK'
108 | __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
| ^~~~~~~~~~~~~~~~
drivers/mailbox/apple-asc-mailbox.c:242:17: note: in expansion of macro 'FIELD_GET'
242 | buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg);
| ^~~~~~~~~
include/linux/bits.h:38:31: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/mailbox/apple-asc-mailbox.h:84:41: note: in expansion of macro 'GENMASK'
84 | #define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(39, 0)
| ^~~~~~~
drivers/mailbox/apple-asc-mailbox.c:242:27: note: in expansion of macro 'APPLE_RTKIT_BUFFER_REQUEST_IOVA'
242 | buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/mailbox/apple-asc-mailbox.h:4,
from drivers/mailbox/apple-asc-mailbox.c:3:
include/linux/bits.h:36:11: warning: right shift count is negative [-Wshift-count-negative]
36 | (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
| ^~
include/linux/bitfield.h:109:30: note: in definition of macro 'FIELD_GET'
109 | (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
| ^~~~~
include/linux/bits.h:38:31: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/mailbox/apple-asc-mailbox.h:84:41: note: in expansion of macro 'GENMASK'
84 | #define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(39, 0)
| ^~~~~~~
drivers/mailbox/apple-asc-mailbox.c:242:27: note: in expansion of macro 'APPLE_RTKIT_BUFFER_REQUEST_IOVA'
242 | buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bits.h:36:11: warning: right shift count is negative [-Wshift-count-negative]
36 | (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
| ^~
include/linux/bitfield.h:42:38: note: in definition of macro '__bf_shf'
42 | #define __bf_shf(x) (__builtin_ffsll(x) - 1)
| ^
drivers/mailbox/apple-asc-mailbox.c:242:17: note: in expansion of macro 'FIELD_GET'
242 | buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg);
| ^~~~~~~~~
include/linux/bits.h:38:31: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/mailbox/apple-asc-mailbox.h:84:41: note: in expansion of macro 'GENMASK'
84 | #define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(39, 0)
| ^~~~~~~
drivers/mailbox/apple-asc-mailbox.c:242:27: note: in expansion of macro 'APPLE_RTKIT_BUFFER_REQUEST_IOVA'
242 | buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from drivers/mailbox/apple-asc-mailbox.h:9,
from drivers/mailbox/apple-asc-mailbox.c:3:
>> drivers/mailbox/apple-asc-mailbox.c:258:4: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
258 | "coprocessor sent shmem buffer with 0x%zx bytes at 0x%llx outside of the configured region 0x%llx...0x%llx",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/mailbox/apple-asc-mailbox.c:256:3: note: in expansion of macro 'dev_warn'
256 | dev_warn(
| ^~~~~~~~
drivers/mailbox/apple-asc-mailbox.c:258:60: note: format string is defined here
258 | "coprocessor sent shmem buffer with 0x%zx bytes at 0x%llx outside of the configured region 0x%llx...0x%llx",
| ~~~^
| |
| long long unsigned int
| %x
In file included from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from drivers/mailbox/apple-asc-mailbox.h:9,
from drivers/mailbox/apple-asc-mailbox.c:3:
>> drivers/mailbox/apple-asc-mailbox.c:258:4: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
258 | "coprocessor sent shmem buffer with 0x%zx bytes at 0x%llx outside of the configured region 0x%llx...0x%llx",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/mailbox/apple-asc-mailbox.c:256:3: note: in expansion of macro 'dev_warn'
256 | dev_warn(
| ^~~~~~~~
drivers/mailbox/apple-asc-mailbox.c:258:100: note: format string is defined here
258 | "coprocessor sent shmem buffer with 0x%zx bytes at 0x%llx outside of the configured region 0x%llx...0x%llx",
| ~~~^
| |
| long long unsigned int
| %x
In file included from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from drivers/mailbox/apple-asc-mailbox.h:9,
from drivers/mailbox/apple-asc-mailbox.c:3:
drivers/mailbox/apple-asc-mailbox.c:258:4: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
258 | "coprocessor sent shmem buffer with 0x%zx bytes at 0x%llx outside of the configured region 0x%llx...0x%llx",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/mailbox/apple-asc-mailbox.c:256:3: note: in expansion of macro 'dev_warn'
256 | dev_warn(
| ^~~~~~~~
drivers/mailbox/apple-asc-mailbox.c:258:109: note: format string is defined here
258 | "coprocessor sent shmem buffer with 0x%zx bytes at 0x%llx outside of the configured region 0x%llx...0x%llx",
| ~~~^
| |
| long long unsigned int
| %x
In file included from <command-line>:
drivers/mailbox/apple-asc-mailbox.c: In function '__shmem_dma_handle_request':
include/linux/bits.h:35:22: warning: left shift count >= width of type [-Wshift-count-overflow]
35 | (((~UL(0)) - (UL(1) << (l)) + 1) & \
| ^~
include/linux/compiler_types.h:308:9: note: in definition of macro '__compiletime_assert'
308 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:328:2: note: in expansion of macro '_compiletime_assert'
328 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:46:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
46 | BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:108:3: note: in expansion of macro '__BF_FIELD_CHECK'
108 | __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
| ^~~~~~~~~~~~~~~~
drivers/mailbox/apple-asc-mailbox.c:278:17: note: in expansion of macro 'FIELD_GET'
278 | buffer->size = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_SIZE, msg) << 12;
| ^~~~~~~~~
include/linux/bits.h:38:31: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/mailbox/apple-asc-mailbox.h:83:41: note: in expansion of macro 'GENMASK'
83 | #define APPLE_RTKIT_BUFFER_REQUEST_SIZE GENMASK(51, 44)
| ^~~~~~~
drivers/mailbox/apple-asc-mailbox.c:278:27: note: in expansion of macro 'APPLE_RTKIT_BUFFER_REQUEST_SIZE'
278 | buffer->size = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_SIZE, msg) << 12;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bits.h:36:11: warning: right shift count is negative [-Wshift-count-negative]
36 | (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
| ^~
include/linux/compiler_types.h:308:9: note: in definition of macro '__compiletime_assert'
308 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:328:2: note: in expansion of macro '_compiletime_assert'
328 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:46:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
46 | BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:108:3: note: in expansion of macro '__BF_FIELD_CHECK'
108 | __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
| ^~~~~~~~~~~~~~~~
drivers/mailbox/apple-asc-mailbox.c:278:17: note: in expansion of macro 'FIELD_GET'
278 | buffer->size = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_SIZE, msg) << 12;
| ^~~~~~~~~
include/linux/bits.h:38:31: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/mailbox/apple-asc-mailbox.h:83:41: note: in expansion of macro 'GENMASK'
83 | #define APPLE_RTKIT_BUFFER_REQUEST_SIZE GENMASK(51, 44)
| ^~~~~~~
drivers/mailbox/apple-asc-mailbox.c:278:27: note: in expansion of macro 'APPLE_RTKIT_BUFFER_REQUEST_SIZE'
278 | buffer->size = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_SIZE, msg) << 12;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bits.h:35:22: warning: left shift count >= width of type [-Wshift-count-overflow]
35 | (((~UL(0)) - (UL(1) << (l)) + 1) & \
| ^~
include/linux/compiler_types.h:308:9: note: in definition of macro '__compiletime_assert'
308 | if (!(condition)) \


vim +258 drivers/mailbox/apple-asc-mailbox.c

236
237 static void shmem_iobuf_handle_request(struct apple_mbox *apple_mbox,
238 struct mbox_chan *chan, u64 msg,
239 struct apple_mbox_shared_memory *buffer)
240 {
241 buffer->size = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_SIZE, msg) << 12;
242 buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg);
243
244 if (WARN_ON(!apple_mbox->mmio_shmem))
245 goto error;
246
247 /*
248 * these are always bugs (or a rogue coprocessor firmware) and we can't
249 * do anything here to recover. this endpoint just won't work.
250 * (e.g. we won't get syslog messages or can't read crashlogs)
251 */
252 if (buffer->iova < apple_mbox->mmio_shmem->start ||
253 buffer->iova > apple_mbox->mmio_shmem->end ||
254 buffer->iova + buffer->size < apple_mbox->mmio_shmem->start ||
255 buffer->iova + buffer->size > apple_mbox->mmio_shmem->end) {
256 dev_warn(
257 apple_mbox->dev,
> 258 "coprocessor sent shmem buffer with 0x%zx bytes at 0x%llx outside of the configured region 0x%llx...0x%llx",
259 buffer->size, buffer->iova,
260 apple_mbox->mmio_shmem->start,
261 apple_mbox->mmio_shmem->end);
262 goto error;
263 }
264
265 buffer->iomem =
266 devm_ioremap_np(apple_mbox->dev, buffer->iova, buffer->size);
267 return;
268
269 error:
270 buffer->size = 0;
271 buffer->iova = 0;
272 }
273

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

Attachment: .config.gz
Description: application/gzip