[axboe-block:for-5.17/drivers 77/78] drivers/block/null_blk/main.c:1577:55: sparse: sparse: incorrect type in argument 3 (different base types)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-5.17/drivers
head: db67097aa6f2587b44055f2e16db72a11e17faef
commit: 2385ebf38f94d4f7761b1e9a4973d04753da02c2 [77/78] block: null_blk: batched complete poll requests
config: x86_64-rhel-8.3-kselftests (https://download.01.org/0day-ci/archive/20211211/202112110756.lMQBZRW5-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/com...
git remote add axboe-block https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
git fetch --no-tags axboe-block for-5.17/drivers
git checkout 2385ebf38f94d4f7761b1e9a4973d04753da02c2
# save the config file to linux build tree
mkdir build_dir
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/block/null_blk/main.c:1577:55: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected int ioerror @@ got restricted blk_status_t [usertype] error @@
drivers/block/null_blk/main.c:1577:55: sparse: expected int ioerror
drivers/block/null_blk/main.c:1577:55: sparse: got restricted blk_status_t [usertype] error
vim +1577 drivers/block/null_blk/main.c
1557
1558 static int null_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
1559 {
1560 struct nullb_queue *nq = hctx->driver_data;
1561 LIST_HEAD(list);
1562 int nr = 0;
1563
1564 spin_lock(&nq->poll_lock);
1565 list_splice_init(&nq->poll_list, &list);
1566 spin_unlock(&nq->poll_lock);
1567
1568 while (!list_empty(&list)) {
1569 struct nullb_cmd *cmd;
1570 struct request *req;
1571
1572 req = list_first_entry(&list, struct request, queuelist);
1573 list_del_init(&req->queuelist);
1574 cmd = blk_mq_rq_to_pdu(req);
1575 cmd->error = null_process_cmd(cmd, req_op(req), blk_rq_pos(req),
1576 blk_rq_sectors(req));
> 1577 if (!blk_mq_add_to_batch(req, iob, cmd->error,
1578 blk_mq_end_request_batch))
1579 end_cmd(cmd);
1580 nr++;
1581 }
1582
1583 return nr;
1584 }
1585
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week
[melver:review/uaccess-logging 4/6] kernel/uaccess-buffer.c:62:31: sparse: sparse: incorrect type in argument 1 (different address spaces)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/melver/linux.git review/uaccess-logging
head: b0aa74824d0cd2fca9a45f5328b355949217f721
commit: 8ebb2cf0597b5485d0e3aa745fb79d9495ac9b97 [4/6] uaccess-buffer: add CONFIG_GENERIC_ENTRY support
config: i386-randconfig-s031-20211207 (https://download.01.org/0day-ci/archive/20211211/202112110605.yKU6WJER-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/melver/linux.git/commit/?...
git remote add melver https://git.kernel.org/pub/scm/linux/kernel/git/melver/linux.git
git fetch --no-tags melver review/uaccess-logging
git checkout 8ebb2cf0597b5485d0e3aa745fb79d9495ac9b97
# save the config file to linux build tree
mkdir build_dir
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> kernel/uaccess-buffer.c:62:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/uaccess-buffer.c:62:31: sparse: expected struct spinlock [usertype] *lock
kernel/uaccess-buffer.c:62:31: sparse: got struct spinlock [noderef] __rcu *
kernel/uaccess-buffer.c:65:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/uaccess-buffer.c:65:33: sparse: expected struct spinlock [usertype] *lock
kernel/uaccess-buffer.c:65:33: sparse: got struct spinlock [noderef] __rcu *
>> kernel/uaccess-buffer.c:83:13: sparse: sparse: Using plain integer as NULL pointer
vim +62 kernel/uaccess-buffer.c
b3442207580a7a Peter Collingbourne 2021-12-07 59
b3442207580a7a Peter Collingbourne 2021-12-07 60 void __uaccess_buffer_post_exit_loop(void)
b3442207580a7a Peter Collingbourne 2021-12-07 61 {
b3442207580a7a Peter Collingbourne 2021-12-07 @62 spin_lock_irq(¤t->sighand->siglock);
b3442207580a7a Peter Collingbourne 2021-12-07 63 current->blocked = current->real_blocked;
b3442207580a7a Peter Collingbourne 2021-12-07 64 recalc_sigpending();
b3442207580a7a Peter Collingbourne 2021-12-07 65 spin_unlock_irq(¤t->sighand->siglock);
b3442207580a7a Peter Collingbourne 2021-12-07 66 }
b3442207580a7a Peter Collingbourne 2021-12-07 67
b3442207580a7a Peter Collingbourne 2021-12-07 68 void uaccess_buffer_free(struct task_struct *tsk)
b3442207580a7a Peter Collingbourne 2021-12-07 69 {
b3442207580a7a Peter Collingbourne 2021-12-07 70 struct uaccess_buffer_info *buf = &tsk->uaccess_buffer;
b3442207580a7a Peter Collingbourne 2021-12-07 71
b3442207580a7a Peter Collingbourne 2021-12-07 72 kfree(buf->kbegin);
b3442207580a7a Peter Collingbourne 2021-12-07 73 clear_syscall_work(UACCESS_BUFFER_EXIT);
b3442207580a7a Peter Collingbourne 2021-12-07 74 buf->kbegin = buf->kcur = buf->kend = NULL;
b3442207580a7a Peter Collingbourne 2021-12-07 75 }
b3442207580a7a Peter Collingbourne 2021-12-07 76
b3442207580a7a Peter Collingbourne 2021-12-07 77 void __uaccess_buffer_syscall_entry(void)
b3442207580a7a Peter Collingbourne 2021-12-07 78 {
b3442207580a7a Peter Collingbourne 2021-12-07 79 struct uaccess_buffer_info *buf = ¤t->uaccess_buffer;
b3442207580a7a Peter Collingbourne 2021-12-07 80 struct uaccess_descriptor desc;
b3442207580a7a Peter Collingbourne 2021-12-07 81
b3442207580a7a Peter Collingbourne 2021-12-07 82 if (get_user(buf->desc_ptr, buf->desc_ptr_ptr) || !buf->desc_ptr ||
b3442207580a7a Peter Collingbourne 2021-12-07 @83 put_user(0, buf->desc_ptr_ptr) ||
b3442207580a7a Peter Collingbourne 2021-12-07 84 copy_from_user(&desc, buf->desc_ptr, sizeof(desc)))
b3442207580a7a Peter Collingbourne 2021-12-07 85 return;
b3442207580a7a Peter Collingbourne 2021-12-07 86
b3442207580a7a Peter Collingbourne 2021-12-07 87 if (desc.size > 1024)
b3442207580a7a Peter Collingbourne 2021-12-07 88 desc.size = 1024;
b3442207580a7a Peter Collingbourne 2021-12-07 89
b3442207580a7a Peter Collingbourne 2021-12-07 90 if (buf->kend - buf->kbegin != desc.size)
b3442207580a7a Peter Collingbourne 2021-12-07 91 buf->kbegin =
b3442207580a7a Peter Collingbourne 2021-12-07 92 krealloc_array(buf->kbegin, desc.size,
b3442207580a7a Peter Collingbourne 2021-12-07 93 sizeof(struct uaccess_buffer_entry),
b3442207580a7a Peter Collingbourne 2021-12-07 94 GFP_KERNEL);
b3442207580a7a Peter Collingbourne 2021-12-07 95 if (!buf->kbegin)
b3442207580a7a Peter Collingbourne 2021-12-07 96 return;
b3442207580a7a Peter Collingbourne 2021-12-07 97
b3442207580a7a Peter Collingbourne 2021-12-07 98 set_syscall_work(UACCESS_BUFFER_EXIT);
b3442207580a7a Peter Collingbourne 2021-12-07 99 buf->kcur = buf->kbegin;
b3442207580a7a Peter Collingbourne 2021-12-07 100 buf->kend = buf->kbegin + desc.size;
b3442207580a7a Peter Collingbourne 2021-12-07 101 buf->ubegin =
b3442207580a7a Peter Collingbourne 2021-12-07 102 (struct uaccess_buffer_entry __user *)(unsigned long)desc.addr;
b3442207580a7a Peter Collingbourne 2021-12-07 103 }
b3442207580a7a Peter Collingbourne 2021-12-07 104
:::::: The code at line 62 was first introduced by commit
:::::: b3442207580a7ad112ed80ebff4f516282979c3b uaccess-buffer: add core code
:::::: TO: Peter Collingbourne <pcc(a)google.com>
:::::: CC: Marco Elver <elver(a)google.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week
[superna9999:amlogic/v5.17/g12-dsi 10/23] drivers/gpu/drm/meson/meson_encoder_dsi.c:125:69: warning: variable 'ret' is uninitialized when used here
by kernel test robot
tree: https://github.com/superna9999/linux amlogic/v5.17/g12-dsi
head: 62dac9179f2937dc08bffe08d15c6846bc4aedb4
commit: d521159dd8a996678230b50e4ecafcdf50648c52 [10/23] fixup! WIP: drm/meson: add DSI encoder
config: arm-randconfig-r033-20211210 (https://download.01.org/0day-ci/archive/20211211/202112110644.NcoPvA8p-lk...)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/superna9999/linux/commit/d521159dd8a996678230b50e4ecaf...
git remote add superna9999 https://github.com/superna9999/linux
git fetch --no-tags superna9999 amlogic/v5.17/g12-dsi
git checkout d521159dd8a996678230b50e4ecafcdf50648c52
# 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=arm SHELL=/bin/bash drivers/gpu/drm/meson/
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/gpu/drm/meson/meson_encoder_dsi.c:125:69: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
dev_err(priv->dev, "Failed to find DSI transceiver bridge: %d\n", ret);
^~~
include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
_p_func(dev, fmt, ##__VA_ARGS__); \
^~~~~~~~~~~
drivers/gpu/drm/meson/meson_encoder_dsi.c:108:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.
vim +/ret +125 drivers/gpu/drm/meson/meson_encoder_dsi.c
6b197be782e0410 Neil Armstrong 2021-12-09 103
6b197be782e0410 Neil Armstrong 2021-12-09 104 int meson_encoder_dsi_init(struct meson_drm *priv)
6b197be782e0410 Neil Armstrong 2021-12-09 105 {
6b197be782e0410 Neil Armstrong 2021-12-09 106 struct meson_encoder_dsi *meson_encoder_dsi;
6b197be782e0410 Neil Armstrong 2021-12-09 107 struct device_node *remote;
6b197be782e0410 Neil Armstrong 2021-12-09 108 int ret;
6b197be782e0410 Neil Armstrong 2021-12-09 109
6b197be782e0410 Neil Armstrong 2021-12-09 110 DRM_DEBUG_DRIVER("\n");
6b197be782e0410 Neil Armstrong 2021-12-09 111
6b197be782e0410 Neil Armstrong 2021-12-09 112 meson_encoder_dsi = devm_kzalloc(priv->dev, sizeof(*meson_encoder_dsi), GFP_KERNEL);
6b197be782e0410 Neil Armstrong 2021-12-09 113 if (!meson_encoder_dsi)
6b197be782e0410 Neil Armstrong 2021-12-09 114 return -ENOMEM;
6b197be782e0410 Neil Armstrong 2021-12-09 115
6b197be782e0410 Neil Armstrong 2021-12-09 116 /* DSI Transceiver Bridge */
6b197be782e0410 Neil Armstrong 2021-12-09 117 remote = of_graph_get_remote_node(priv->dev->of_node, 1, 0);
6b197be782e0410 Neil Armstrong 2021-12-09 118 if (!remote) {
6b197be782e0410 Neil Armstrong 2021-12-09 119 dev_err(priv->dev, "DSI transceiver device is disabled");
6b197be782e0410 Neil Armstrong 2021-12-09 120 return 0;
6b197be782e0410 Neil Armstrong 2021-12-09 121 }
6b197be782e0410 Neil Armstrong 2021-12-09 122
6b197be782e0410 Neil Armstrong 2021-12-09 123 meson_encoder_dsi->next_bridge = of_drm_find_bridge(remote);
6b197be782e0410 Neil Armstrong 2021-12-09 124 if (!meson_encoder_dsi->next_bridge) {
6b197be782e0410 Neil Armstrong 2021-12-09 @125 dev_err(priv->dev, "Failed to find DSI transceiver bridge: %d\n", ret);
:::::: The code at line 125 was first introduced by commit
:::::: 6b197be782e0410bb911b74fb152daefccce6a29 WIP: drm/meson: add DSI encoder
:::::: TO: Neil Armstrong <narmstrong(a)baylibre.com>
:::::: CC: Neil Armstrong <narmstrong(a)baylibre.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week
[superna9999:amlogic/v5.17/g12-dsi 20/23] drivers/gpu/drm/meson/meson_encoder_dsi.c:59:44: warning: passing argument 2 of 'meson_venc_mipi_dsi_mode_set' discards 'const' qualifier from pointer target type
by kernel test robot
tree: https://github.com/superna9999/linux amlogic/v5.17/g12-dsi
head: 62dac9179f2937dc08bffe08d15c6846bc4aedb4
commit: b186318175a12bdca613ee26b4b452964c795eb3 [20/23] fixup! WIP: drm/meson: add DSI encoder
config: arm-randconfig-r013-20211210 (https://download.01.org/0day-ci/archive/20211211/202112110612.0VVbVR6R-lk...)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
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://github.com/superna9999/linux/commit/b186318175a12bdca613ee26b4b45...
git remote add superna9999 https://github.com/superna9999/linux
git fetch --no-tags superna9999 amlogic/v5.17/g12-dsi
git checkout b186318175a12bdca613ee26b4b452964c795eb3
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/gpu/drm/meson/
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/gpu/drm/meson/meson_encoder_dsi.c: In function 'meson_encoder_dsi_mode_set':
>> drivers/gpu/drm/meson/meson_encoder_dsi.c:59:44: warning: passing argument 2 of 'meson_venc_mipi_dsi_mode_set' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
59 | meson_venc_mipi_dsi_mode_set(priv, mode);
| ^~~~
In file included from drivers/gpu/drm/meson/meson_encoder_dsi.c:24:
drivers/gpu/drm/meson/meson_venc.h:71:60: note: expected 'struct drm_display_mode *' but argument is of type 'const struct drm_display_mode *'
71 | struct drm_display_mode *mode);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
vim +59 drivers/gpu/drm/meson/meson_encoder_dsi.c
6b197be782e0410 Neil Armstrong 2021-12-09 47
b186318175a12bd Neil Armstrong 2021-12-10 48 static void meson_encoder_dsi_mode_set(struct drm_bridge *bridge,
b186318175a12bd Neil Armstrong 2021-12-10 49 const struct drm_display_mode *mode,
b186318175a12bd Neil Armstrong 2021-12-10 50 const struct drm_display_mode *adjusted_mode)
6b197be782e0410 Neil Armstrong 2021-12-09 51 {
6b197be782e0410 Neil Armstrong 2021-12-09 52 struct meson_encoder_dsi *encoder_dsi = bridge_to_meson_encoder_dsi(bridge);
6b197be782e0410 Neil Armstrong 2021-12-09 53 struct meson_drm *priv = encoder_dsi->priv;
6b197be782e0410 Neil Armstrong 2021-12-09 54
b186318175a12bd Neil Armstrong 2021-12-10 55 pr_err("%s:%d\n", __func__, __LINE__);
6b197be782e0410 Neil Armstrong 2021-12-09 56
b186318175a12bd Neil Armstrong 2021-12-10 57 meson_vclk_setup(priv, MESON_VCLK_TARGET_DSI, mode->clock, 0, 0, 0, false);
6b197be782e0410 Neil Armstrong 2021-12-09 58
d521159dd8a9966 Neil Armstrong 2021-12-10 @59 meson_venc_mipi_dsi_mode_set(priv, mode);
e1e87e576f5befb Neil Armstrong 2021-12-09 60 meson_encl_load_gamma(priv);
6b197be782e0410 Neil Armstrong 2021-12-09 61
b186318175a12bd Neil Armstrong 2021-12-10 62 writel_relaxed(0, priv->io_base + _REG(ENCL_VIDEO_EN));
b186318175a12bd Neil Armstrong 2021-12-10 63
e1e87e576f5befb Neil Armstrong 2021-12-09 64 writel_bits_relaxed(BIT(3), BIT(3), priv->io_base + _REG(ENCL_VIDEO_MODE_ADV));
e1e87e576f5befb Neil Armstrong 2021-12-09 65 writel_relaxed(0, priv->io_base + _REG(ENCL_TST_EN));
b186318175a12bd Neil Armstrong 2021-12-10 66 }
b186318175a12bd Neil Armstrong 2021-12-10 67
:::::: The code at line 59 was first introduced by commit
:::::: d521159dd8a996678230b50e4ecafcdf50648c52 fixup! WIP: drm/meson: add DSI encoder
:::::: TO: Neil Armstrong <narmstrong(a)baylibre.com>
:::::: CC: Neil Armstrong <narmstrong(a)baylibre.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week
[PATCH] NOUPSTREAM: ANDROID: usb: gadget: configfs: fix itnull.cocci warnings (fwd)
by Julia Lawall
Hello,
The patch with the call to BAD is a Coccinelle hack, but it remains the
case that fi cannot be NULL in the first line of the body of the
list_for_each loop.
julia
---------- Forwarded message ----------
Date: Tue, 7 Dec 2021 18:50:38 +0800
From: kernel test robot <lkp(a)intel.com>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <julia.lawall(a)lip6.fr>
Subject: [PATCH] NOUPSTREAM: ANDROID: usb: gadget: configfs: fix itnull.cocci
warnings
CC: kbuild-all(a)lists.01.org
TO: cros-kernel-buildreports(a)googlegroups.com
TO: Guenter Roeck <groeck(a)google.com>
From: kernel test robot <lkp(a)intel.com>
drivers/usb/gadget/configfs.c:1554:6-8: ERROR: iterator variable bound on line 1553 cannot be NULL
Many iterators have the property that the first argument is always bound
to a real list element, never NULL.
Semantic patch information:
False positives arise for some iterators that do not have this property,
or in cases when the loop cursor is reassigned. The latter should only
happen when the matched code is on the way to a loop exit (break, goto,
or return).
Generated by: scripts/coccinelle/iterators/itnull.cocci
CC: Badhri Jagan Sridharan <Badhri(a)google.com>
Reported-by: kernel test robot <lkp(a)intel.com>
Signed-off-by: kernel test robot <lkp(a)intel.com>
---
tree: https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.15
head: 617fec3654adc5dfc39d303b5b371fc4e1be600b
commit: db87c70afb233e6f6c5fb8164f92b1bef4690a1b [1992/2561] NOUPSTREAM: ANDROID: usb: gadget: configfs: Add Uevent to notify userspace
:::::: branch date: 8 hours ago
:::::: commit date: 2 weeks ago
Please take the patch only if it's a positive warning. Thanks!
configfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -1551,7 +1551,7 @@ static int android_setup(struct usb_gadg
}
spin_unlock_irqrestore(&cdev->lock, flags);
list_for_each_entry(fi, &gi->available_func, cfs_list) {
- if (fi != NULL && fi->f != NULL && fi->f->setup != NULL) {
+ if (BAD(fi != NULL) && fi->f != NULL && fi->f->setup != NULL) {
value = fi->f->setup(fi->f, c);
if (value >= 0)
break;
9 months, 1 week
[intel-lts:5.4/yocto 14111/18531] drivers/mtd/spi-nor/core.c:3383:34: sparse: sparse: cast to restricted __le32
by kernel test robot
tree: https://github.com/intel/linux-intel-lts.git 5.4/yocto
head: 93b630f89c8d94187fd181ae4cbca13b4b47201c
commit: 4541b62447f9a65c9192597304d5f6cd11664386 [14111/18531] mtd: spi-nor: Prepare core / manufacturer code split
config: sh-randconfig-s032-20211206 (https://download.01.org/0day-ci/archive/20211211/202112110458.Vu91dnou-lk...)
compiler: sh4-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/intel/linux-intel-lts/commit/4541b62447f9a65c919259730...
git remote add intel-lts https://github.com/intel/linux-intel-lts.git
git fetch --no-tags intel-lts 5.4/yocto
git checkout 4541b62447f9a65c9192597304d5f6cd11664386
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sh SHELL=/bin/bash drivers/mtd/spi-nor/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/mtd/spi-nor/core.c:3383:34: sparse: sparse: cast to restricted __le32
>> drivers/mtd/spi-nor/core.c:3651:38: sparse: sparse: dubious: x | !y
drivers/mtd/spi-nor/core.c:3837:27: sparse: sparse: cast to restricted __le32
drivers/mtd/spi-nor/core.c:3931:29: sparse: sparse: cast to restricted __le32
drivers/mtd/spi-nor/core.c:4071:13: sparse: sparse: cast to restricted __le32
vim +3383 drivers/mtd/spi-nor/core.c
2aaa5f7e0c07a0 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2018-12-06 3324
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3325 /**
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3326 * spi_nor_parse_bfpt() - read and parse the Basic Flash Parameter Table.
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3327 * @nor: pointer to a 'struct spi_nor'
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3328 * @bfpt_header: pointer to the 'struct sfdp_parameter_header' describing
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3329 * the Basic Flash Parameter Table length and version
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3330 * @params: pointer to the 'struct spi_nor_flash_parameter' to be
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3331 * filled
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3332 *
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3333 * The Basic Flash Parameter Table is the main and only mandatory table as
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3334 * defined by the SFDP (JESD216) specification.
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3335 * It provides us with the total size (memory density) of the data array and
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3336 * the number of address bytes for Fast Read, Page Program and Sector Erase
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3337 * commands.
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3338 * For Fast READ commands, it also gives the number of mode clock cycles and
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3339 * wait states (regrouped in the number of dummy clock cycles) for each
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3340 * supported instruction op code.
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3341 * For Page Program, the page size is now available since JESD216 rev A, however
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3342 * the supported instruction op codes are still not provided.
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3343 * For Sector Erase commands, this table stores the supported instruction op
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3344 * codes and the associated sector sizes.
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3345 * Finally, the Quad Enable Requirements (QER) are also available since JESD216
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3346 * rev A. The QER bits encode the manufacturer dependent procedure to be
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3347 * executed to set the Quad Enable (QE) bit in some internal register of the
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3348 * Quad SPI memory. Indeed the QE bit, when it exists, must be set before
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3349 * sending any Quad SPI command to the memory. Actually, setting the QE bit
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3350 * tells the memory to reassign its WP# and HOLD#/RESET# pins to functions IO2
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3351 * and IO3 hence enabling 4 (Quad) I/O lines.
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3352 *
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3353 * Return: 0 on success, -errno otherwise.
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3354 */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3355 static int spi_nor_parse_bfpt(struct spi_nor *nor,
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3356 const struct sfdp_parameter_header *bfpt_header,
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3357 struct spi_nor_flash_parameter *params)
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3358 {
c46872170a54c9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2019-08-23 3359 struct spi_nor_erase_map *map = ¶ms->erase_map;
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3360 struct spi_nor_erase_type *erase_type = map->erase_type;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3361 struct sfdp_bfpt bfpt;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3362 size_t len;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3363 int i, cmd, err;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3364 u32 addr;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3365 u16 half;
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3366 u8 erase_mask;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3367
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3368 /* JESD216 Basic Flash Parameter Table length is at least 9 DWORDs. */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3369 if (bfpt_header->length < BFPT_DWORD_MAX_JESD216)
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3370 return -EINVAL;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3371
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3372 /* Read the Basic Flash Parameter Table. */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3373 len = min_t(size_t, sizeof(bfpt),
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3374 bfpt_header->length * sizeof(u32));
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3375 addr = SFDP_PARAM_HEADER_PTP(bfpt_header);
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3376 memset(&bfpt, 0, sizeof(bfpt));
bfa4133795e5a0 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-09-06 3377 err = spi_nor_read_sfdp_dma_unsafe(nor, addr, len, &bfpt);
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3378 if (err < 0)
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3379 return err;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3380
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3381 /* Fix endianness of the BFPT DWORDs. */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3382 for (i = 0; i < BFPT_DWORD_MAX; i++)
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 @3383 bfpt.dwords[i] = le32_to_cpu(bfpt.dwords[i]);
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3384
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3385 /* Number of address bytes. */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3386 switch (bfpt.dwords[BFPT_DWORD(1)] & BFPT_DWORD1_ADDRESS_BYTES_MASK) {
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3387 case BFPT_DWORD1_ADDRESS_BYTES_3_ONLY:
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3388 nor->addr_width = 3;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3389 break;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3390
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3391 case BFPT_DWORD1_ADDRESS_BYTES_4_ONLY:
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3392 nor->addr_width = 4;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3393 break;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3394
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3395 default:
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3396 break;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3397 }
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3398
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3399 /* Flash Memory Density (in bits). */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3400 params->size = bfpt.dwords[BFPT_DWORD(2)];
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3401 if (params->size & BIT(31)) {
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3402 params->size &= ~BIT(31);
b8f3911610529b drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2017-09-12 3403
b8f3911610529b drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2017-09-12 3404 /*
b8f3911610529b drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2017-09-12 3405 * Prevent overflows on params->size. Anyway, a NOR of 2^64
b8f3911610529b drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2017-09-12 3406 * bits is unlikely to exist so this error probably means
b8f3911610529b drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2017-09-12 3407 * the BFPT we are reading is corrupted/wrong.
b8f3911610529b drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2017-09-12 3408 */
b8f3911610529b drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2017-09-12 3409 if (params->size > 63)
b8f3911610529b drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2017-09-12 3410 return -EINVAL;
b8f3911610529b drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2017-09-12 3411
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3412 params->size = 1ULL << params->size;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3413 } else {
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3414 params->size++;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3415 }
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3416 params->size >>= 3; /* Convert to bytes. */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3417
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3418 /* Fast Read settings. */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3419 for (i = 0; i < ARRAY_SIZE(sfdp_bfpt_reads); i++) {
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3420 const struct sfdp_bfpt_read *rd = &sfdp_bfpt_reads[i];
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3421 struct spi_nor_read_command *read;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3422
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3423 if (!(bfpt.dwords[rd->supported_dword] & rd->supported_bit)) {
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3424 params->hwcaps.mask &= ~rd->hwcaps;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3425 continue;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3426 }
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3427
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3428 params->hwcaps.mask |= rd->hwcaps;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3429 cmd = spi_nor_hwcaps_read2cmd(rd->hwcaps);
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3430 read = ¶ms->reads[cmd];
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3431 half = bfpt.dwords[rd->settings_dword] >> rd->settings_shift;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3432 spi_nor_set_read_settings_from_bfpt(read, half, rd->proto);
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3433 }
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3434
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3435 /*
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3436 * Sector Erase settings. Reinitialize the uniform erase map using the
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3437 * Erase Types defined in the bfpt table.
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3438 */
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3439 erase_mask = 0;
c46872170a54c9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2019-08-23 3440 memset(¶ms->erase_map, 0, sizeof(params->erase_map));
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3441 for (i = 0; i < ARRAY_SIZE(sfdp_bfpt_erases); i++) {
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3442 const struct sfdp_bfpt_erase *er = &sfdp_bfpt_erases[i];
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3443 u32 erasesize;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3444 u8 opcode;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3445
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3446 half = bfpt.dwords[er->dword] >> er->shift;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3447 erasesize = half & 0xff;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3448
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3449 /* erasesize == 0 means this Erase Type is not supported. */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3450 if (!erasesize)
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3451 continue;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3452
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3453 erasesize = 1U << erasesize;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3454 opcode = (half >> 8) & 0xff;
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3455 erase_mask |= BIT(i);
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3456 spi_nor_set_erase_settings_from_bfpt(&erase_type[i], erasesize,
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3457 opcode, i);
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3458 }
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3459 spi_nor_init_uniform_erase_map(map, erase_mask, params->size);
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3460 /*
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3461 * Sort all the map's Erase Types in ascending order with the smallest
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3462 * erase size being the first member in the erase_type array.
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3463 */
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3464 sort(erase_type, SNOR_ERASE_TYPE_MAX, sizeof(erase_type[0]),
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3465 spi_nor_map_cmp_erase_type, NULL);
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3466 /*
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3467 * Sort the erase types in the uniform region in order to update the
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3468 * uniform_erase_type bitmask. The bitmask will be used later on when
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3469 * selecting the uniform erase.
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3470 */
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3471 spi_nor_regions_sort_erase_types(map);
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3472 map->uniform_erase_type = map->uniform_region.offset &
5390a8df769ec9 drivers/mtd/spi-nor/spi-nor.c Tudor Ambarus 2018-09-11 3473 SNOR_ERASE_TYPE_MASK;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3474
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3475 /* Stop here if not JESD216 rev A or later. */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3476 if (bfpt_header->length < BFPT_DWORD_MAX)
2aaa5f7e0c07a0 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2018-12-06 3477 return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt,
2aaa5f7e0c07a0 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2018-12-06 3478 params);
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3479
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3480 /* Page size: this field specifies 'N' so the page size = 2^N bytes. */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3481 params->page_size = bfpt.dwords[BFPT_DWORD(11)];
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3482 params->page_size &= BFPT_DWORD11_PAGE_SIZE_MASK;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3483 params->page_size >>= BFPT_DWORD11_PAGE_SIZE_SHIFT;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3484 params->page_size = 1U << params->page_size;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3485
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3486 /* Quad Enable Requirements. */
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3487 switch (bfpt.dwords[BFPT_DWORD(15)] & BFPT_DWORD15_QER_MASK) {
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3488 case BFPT_DWORD15_QER_NONE:
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3489 params->quad_enable = NULL;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3490 break;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3491
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3492 case BFPT_DWORD15_QER_SR2_BIT1_BUGGY:
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3493 case BFPT_DWORD15_QER_SR2_BIT1_NO_RD:
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3494 params->quad_enable = spansion_no_read_cr_quad_enable;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3495 break;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3496
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3497 case BFPT_DWORD15_QER_SR1_BIT6:
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3498 params->quad_enable = macronix_quad_enable;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3499 break;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3500
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3501 case BFPT_DWORD15_QER_SR2_BIT7:
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3502 params->quad_enable = sr2_bit7_quad_enable;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3503 break;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3504
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3505 case BFPT_DWORD15_QER_SR2_BIT1:
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3506 params->quad_enable = spansion_read_cr_quad_enable;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3507 break;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3508
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3509 default:
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3510 return -EINVAL;
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3511 }
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3512
2aaa5f7e0c07a0 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon 2018-12-06 3513 return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt, params);
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3514 }
f384b352cbf031 drivers/mtd/spi-nor/spi-nor.c Cyrille Pitchen 2017-06-26 3515
:::::: The code at line 3383 was first introduced by commit
:::::: f384b352cbf0310fd20c379c4710408c70e769b6 mtd: spi-nor: parse Serial Flash Discoverable Parameters (SFDP) tables
:::::: TO: Cyrille Pitchen <cyrille.pitchen(a)microchip.com>
:::::: CC: Cyrille Pitchen <cyrille.pitchen(a)wedev4u.fr>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week
[freescale-fslc:5.10-2.1.x-imx 8935/16146] drivers/staging/fsl_qbman/fsl_usdpaa.c:1161:17: error: 'strncpy' output may be truncated copying 15 bytes from a string of length 15
by kernel test robot
Hi Florinel,
FYI, the error/warning still remains.
tree: https://github.com/Freescale/linux-fslc 5.10-2.1.x-imx
head: 97b03e732ae16a3b30736ac12cf838a5c2db3eca
commit: 1db839bda044bf4568b6d9191a6a850ba89dbe67 [8935/16146] fsl_qbman: usdpaa: clear ioctl_dma_map string buffers
config: arm-defconfig (https://download.01.org/0day-ci/archive/20211211/202112110452.IVQo1Vuf-lk...)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
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://github.com/Freescale/linux-fslc/commit/1db839bda044bf4568b6d9191a...
git remote add freescale-fslc https://github.com/Freescale/linux-fslc
git fetch --no-tags freescale-fslc 5.10-2.1.x-imx
git checkout 1db839bda044bf4568b6d9191a6a850ba89dbe67
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from include/linux/fsl_usdpaa.h:17,
from drivers/staging/fsl_qbman/dpa_sys.h:66,
from drivers/staging/fsl_qbman/fsl_usdpaa.c:29:
include/linux/fsl_qman.h:415:1: error: alignment 1 of 'struct qm_eqcr_entry' is less than 8 [-Werror=packed-not-aligned]
415 | } __packed;
| ^
include/linux/fsl_qman.h:469:17: error: alignment 1 of 'struct <anonymous>' is less than 8 [-Werror=packed-not-aligned]
469 | } __packed ern;
| ^
include/linux/fsl_qman.h:468:38: error: 'fd' offset 15 in 'struct <anonymous>' isn't aligned to 8 [-Werror=packed-not-aligned]
468 | struct qm_fd fd;
| ^~
include/linux/fsl_qman.h:486:17: error: alignment 1 of 'struct <anonymous>' is less than 8 [-Werror=packed-not-aligned]
486 | } __packed dcern;
| ^
include/linux/fsl_qman.h:485:38: error: 'fd' offset 15 in 'struct <anonymous>' isn't aligned to 8 [-Werror=packed-not-aligned]
485 | struct qm_fd fd;
| ^~
include/linux/fsl_qman.h:1679:1: error: alignment 1 of 'struct qm_mcr_ceetm_cq_peek_pop_xsfdrread' is less than 8 [-Werror=packed-not-aligned]
1679 | } __packed;
| ^
include/linux/fsl_qman.h:1677:22: error: 'fd' offset 14 in 'struct qm_mcr_ceetm_cq_peek_pop_xsfdrread' isn't aligned to 8 [-Werror=packed-not-aligned]
1677 | struct qm_fd fd;
| ^~
In file included from drivers/staging/fsl_qbman/fsl_usdpaa.c:32:
drivers/staging/fsl_qbman/qman_low.h: In function 'qm_shutdown_fq':
drivers/staging/fsl_qbman/qman_low.h:1291:29: error: variable 'dequeue_wq' set but not used [-Werror=unused-but-set-variable]
1291 | u16 dequeue_wq = 0;
| ^~~~~~~~~~
drivers/staging/fsl_qbman/fsl_usdpaa.c: At top level:
drivers/staging/fsl_qbman/fsl_usdpaa.c:406:6: error: no previous prototype for 'dbci_portal' [-Werror=missing-prototypes]
406 | void dbci_portal(void *addr)
| ^~~~~~~~~~~
drivers/staging/fsl_qbman/fsl_usdpaa.c: In function 'ioctl_dma_map':
>> drivers/staging/fsl_qbman/fsl_usdpaa.c:1161:17: error: 'strncpy' output may be truncated copying 15 bytes from a string of length 15 [-Werror=stringop-truncation]
1161 | strncpy(start_frag->name, i->name, USDPAA_DMA_NAME_MAX - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
vim +/strncpy +1161 drivers/staging/fsl_qbman/fsl_usdpaa.c
1006
1007 static long ioctl_dma_map(struct file *fp, struct ctx *ctx,
1008 struct usdpaa_ioctl_dma_map *i)
1009 {
1010 struct mem_fragment *frag, *start_frag, *next_frag;
1011 struct mem_mapping *map, *tmp;
1012 int ret = 0;
1013 u32 largest_page, so_far = 0;
1014 int frag_count = 0;
1015 unsigned long next_addr = PAGE_SIZE, populate;
1016
1017 /* error checking to ensure values copied from user space are valid */
1018 if (i->len % PAGE_SIZE)
1019 return -EINVAL;
1020
1021 map = kmalloc(sizeof(*map), GFP_KERNEL);
1022 if (!map)
1023 return -ENOMEM;
1024
1025 spin_lock(&mem_lock);
1026 if (i->flags & USDPAA_DMA_FLAG_SHARE) {
1027 list_for_each_entry(frag, &mem_list, list) {
1028 if (frag->refs && (frag->flags &
1029 USDPAA_DMA_FLAG_SHARE) &&
1030 !strncmp(i->name, frag->name,
1031 USDPAA_DMA_NAME_MAX)) {
1032 /* Matching entry */
1033 if ((i->flags & USDPAA_DMA_FLAG_CREATE) &&
1034 !(i->flags & USDPAA_DMA_FLAG_LAZY)) {
1035 ret = -EBUSY;
1036 goto out;
1037 }
1038
1039 /* Check to ensure size matches record */
1040 if (i->len != frag->map_len && i->len) {
1041 pr_err("ioctl_dma_map() Size requested does not match %s and is none zero\n",
1042 frag->name);
1043 ret = -EINVAL;
1044 goto out;
1045 }
1046
1047 /* Check if this has already been mapped
1048 to this process */
1049 list_for_each_entry(tmp, &ctx->maps, list)
1050 if (tmp->root_frag == frag) {
1051 /* Already mapped, just need to
1052 inc ref count */
1053 tmp->refs++;
1054 kfree(map);
1055 i->did_create = 0;
1056 i->len = tmp->total_size;
1057 i->phys_addr = frag->base;
1058 i->ptr = tmp->virt_addr;
1059 spin_unlock(&mem_lock);
1060 return 0;
1061 }
1062 /* Matching entry - just need to map */
1063 i->has_locking = frag->has_locking;
1064 i->did_create = 0;
1065 i->len = frag->map_len;
1066 start_frag = frag;
1067 goto do_map;
1068 }
1069 }
1070 /* No matching entry */
1071 if (!(i->flags & USDPAA_DMA_FLAG_CREATE)) {
1072 pr_err("ioctl_dma_map() No matching entry\n");
1073 ret = -ENOMEM;
1074 goto out;
1075 }
1076 }
1077 /* New fragment required, size must be provided. */
1078 if (!i->len) {
1079 ret = -EINVAL;
1080 goto out;
1081 }
1082
1083 /* Find one of more contiguous fragments that satisfy the total length
1084 trying to minimize the number of fragments
1085 compute the largest page size that the allocation could use */
1086 largest_page = largest_page_size(i->len);
1087 start_frag = NULL;
1088 while (largest_page &&
1089 largest_page <= largest_page_size(phys_size) &&
1090 start_frag == NULL) {
1091 /* Search the list for a frag of that size */
1092 list_for_each_entry(frag, &mem_list, list) {
1093 if (!frag->refs && (frag->len == largest_page)) {
1094 /* See if the next x fragments are free
1095 and can accomidate the size */
1096 u32 found_size = largest_page;
1097 next_frag = list_entry(frag->list.prev,
1098 struct mem_fragment,
1099 list);
1100 /* If the fragement is too small check
1101 if the neighbours cab support it */
1102 while (found_size < i->len) {
1103 if (&mem_list == &next_frag->list)
1104 break; /* End of list */
1105 if (next_frag->refs != 0 ||
1106 next_frag->len == 0)
1107 break; /* not enough space */
1108 found_size += next_frag->len;
1109 next_frag = list_entry(
1110 next_frag->list.prev,
1111 struct mem_fragment,
1112 list);
1113 }
1114 if (found_size >= i->len) {
1115 /* Success! there is enough contigous
1116 free space */
1117 start_frag = frag;
1118 break;
1119 }
1120 }
1121 } /* next frag loop */
1122 /* Couldn't statisfy the request with this
1123 largest page size, try a smaller one */
1124 largest_page <<= 2;
1125 }
1126 if (start_frag == NULL) {
1127 /* Couldn't find proper amount of space */
1128 ret = -ENOMEM;
1129 goto out;
1130 }
1131 i->did_create = 1;
1132 do_map:
1133 /* Verify there is sufficient space to do the mapping */
1134 down_write(¤t->mm->mmap_lock);
1135 next_addr = usdpaa_get_unmapped_area(fp, next_addr, i->len, 0, 0);
1136 up_write(¤t->mm->mmap_lock);
1137
1138 if (next_addr & ~PAGE_MASK) {
1139 ret = -ENOMEM;
1140 goto out;
1141 }
1142
1143 /* We may need to divide the final fragment to accomidate the mapping */
1144 next_frag = start_frag;
1145 while (so_far != i->len) {
1146 BUG_ON(next_frag->len == 0);
1147 while ((next_frag->len + so_far) > i->len) {
1148 /* Split frag until they match */
1149 split_frag(next_frag);
1150 }
1151 so_far += next_frag->len;
1152 next_frag->refs++;
1153 ++frag_count;
1154 next_frag = list_entry(next_frag->list.prev,
1155 struct mem_fragment, list);
1156 }
1157 if (i->did_create) {
1158 size_t name_len = 0;
1159 start_frag->flags = i->flags;
1160 memset(start_frag->name, '\0', USDPAA_DMA_NAME_MAX);
> 1161 strncpy(start_frag->name, i->name, USDPAA_DMA_NAME_MAX - 1);
1162 name_len = strnlen(start_frag->name, USDPAA_DMA_NAME_MAX);
1163 if (name_len >= USDPAA_DMA_NAME_MAX) {
1164 ret = -EFAULT;
1165 goto out;
1166 }
1167 start_frag->map_len = i->len;
1168 start_frag->has_locking = i->has_locking;
1169 init_waitqueue_head(&start_frag->wq);
1170 start_frag->owner = NULL;
1171 }
1172
1173 /* Setup the map entry */
1174 map->root_frag = start_frag;
1175 map->total_size = i->len;
1176 map->frag_count = frag_count;
1177 map->refs = 1;
1178 list_add(&map->list, &ctx->maps);
1179 i->phys_addr = start_frag->base;
1180 out:
1181 spin_unlock(&mem_lock);
1182
1183 if (!ret) {
1184 unsigned long longret;
1185 down_write(¤t->mm->mmap_lock);
1186 longret = do_mmap(fp, next_addr, map->total_size,
1187 PROT_READ |
1188 (i->flags &
1189 USDPAA_DMA_FLAG_RDONLY ? 0
1190 : PROT_WRITE),
1191 MAP_SHARED,
1192 start_frag->pfn_base,
1193 &populate,
1194 NULL);
1195 up_write(¤t->mm->mmap_lock);
1196 if (longret & ~PAGE_MASK) {
1197 ret = (int)longret;
1198 } else {
1199 i->ptr = (void *)longret;
1200 map->virt_addr = i->ptr;
1201 }
1202 } else
1203 kfree(map);
1204 return ret;
1205 }
1206
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week