[chao-linux:simple_copy 2/5] block/blk-lib.c:221 blk_read_to_buf() error: uninitialized symbol 'bio'.
by Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git simple_copy
head: d6f32b90156624ae9dc06ef5873334a48e9b9806
commit: fcbd83ffa72af1eba12bcab1f34e0b956a563e02 [2/5] block: add simple copy support
config: xtensa-randconfig-m031-20210209 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
block/blk-lib.c:221 blk_read_to_buf() error: uninitialized symbol 'bio'.
block/blk-lib.c:352 blkdev_issue_copy() warn: ignoring unreachable code.
vim +/bio +221 block/blk-lib.c
fcbd83ffa72af1e SelvaKumar S 2021-02-08 180 int blk_read_to_buf(struct block_device *bdev, struct blk_copy_payload *payload,
fcbd83ffa72af1e SelvaKumar S 2021-02-08 181 gfp_t gfp_mask, void **buf_p)
fcbd83ffa72af1e SelvaKumar S 2021-02-08 182 {
fcbd83ffa72af1e SelvaKumar S 2021-02-08 183 struct request_queue *q = bdev_get_queue(bdev);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 184 struct bio *bio, *parent = NULL;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 185 void *buf = NULL;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 186 bool is_vmalloc;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 187 int i, nr_srcs, copy_len, ret, cur_size, t_len = 0;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 188
fcbd83ffa72af1e SelvaKumar S 2021-02-08 189 nr_srcs = payload->copy_range;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 190 copy_len = payload->copy_size << SECTOR_SHIFT;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 191
fcbd83ffa72af1e SelvaKumar S 2021-02-08 192 buf = kvmalloc(copy_len, gfp_mask);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 193 if (!buf)
fcbd83ffa72af1e SelvaKumar S 2021-02-08 194 return -ENOMEM;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 195 is_vmalloc = is_vmalloc_addr(buf);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 196
fcbd83ffa72af1e SelvaKumar S 2021-02-08 197 for (i = 0; i < nr_srcs; i++) {
Smatch is complaining that if "nr_secs" is zero then this leads to an
uninitialized variable warning. As a human reviewer I would worry that
payload->copy_range can be controlled by the user, but I don't have an
easy way to check.
fcbd83ffa72af1e SelvaKumar S 2021-02-08 198 cur_size = payload->range[i].len << SECTOR_SHIFT;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 199
fcbd83ffa72af1e SelvaKumar S 2021-02-08 200 bio = bio_map_kern(q, buf + t_len, cur_size, gfp_mask);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 201 if (IS_ERR(bio)) {
fcbd83ffa72af1e SelvaKumar S 2021-02-08 202 ret = PTR_ERR(bio);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 203 goto out;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 204 }
fcbd83ffa72af1e SelvaKumar S 2021-02-08 205
fcbd83ffa72af1e SelvaKumar S 2021-02-08 206 bio->bi_iter.bi_sector = payload->range[i].src;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 207 bio->bi_opf = REQ_OP_READ;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 208 bio_set_dev(bio, bdev);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 209 bio->bi_end_io = NULL;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 210 bio->bi_private = NULL;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 211
fcbd83ffa72af1e SelvaKumar S 2021-02-08 212 if (parent) {
fcbd83ffa72af1e SelvaKumar S 2021-02-08 213 bio_chain(parent, bio);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 214 submit_bio(parent);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 215 }
fcbd83ffa72af1e SelvaKumar S 2021-02-08 216
fcbd83ffa72af1e SelvaKumar S 2021-02-08 217 parent = bio;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 218 t_len += cur_size;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 219 }
fcbd83ffa72af1e SelvaKumar S 2021-02-08 220
fcbd83ffa72af1e SelvaKumar S 2021-02-08 @221 ret = submit_bio_wait(bio);
^^^
fcbd83ffa72af1e SelvaKumar S 2021-02-08 222 bio_put(bio);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 223 if (is_vmalloc)
fcbd83ffa72af1e SelvaKumar S 2021-02-08 224 invalidate_kernel_vmap_range(buf, copy_len);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 225 if (ret)
fcbd83ffa72af1e SelvaKumar S 2021-02-08 226 goto out;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 227
fcbd83ffa72af1e SelvaKumar S 2021-02-08 228 *buf_p = buf;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 229 return 0;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 230 out:
fcbd83ffa72af1e SelvaKumar S 2021-02-08 231 kvfree(buf);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 232 return ret;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 233 }
[ snip ]
fcbd83ffa72af1e SelvaKumar S 2021-02-08 335 int blkdev_issue_copy(struct block_device *bdev, int nr_srcs,
fcbd83ffa72af1e SelvaKumar S 2021-02-08 336 struct range_entry *src_rlist, struct block_device *dest_bdev,
fcbd83ffa72af1e SelvaKumar S 2021-02-08 337 sector_t dest, gfp_t gfp_mask)
fcbd83ffa72af1e SelvaKumar S 2021-02-08 338 {
fcbd83ffa72af1e SelvaKumar S 2021-02-08 339 struct request_queue *q = bdev_get_queue(bdev);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 340 struct blk_copy_payload *payload;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 341 sector_t bs_mask, dest_sect;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 342 void *buf = NULL;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 343 int ret;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 344
fcbd83ffa72af1e SelvaKumar S 2021-02-08 345 ret = blk_prepare_payload(bdev, nr_srcs, src_rlist, gfp_mask, &payload);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 346 if (ret)
fcbd83ffa72af1e SelvaKumar S 2021-02-08 347 return ret;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 348
fcbd83ffa72af1e SelvaKumar S 2021-02-08 349 bs_mask = (bdev_logical_block_size(dest_bdev) >> 9) - 1;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 350 if (dest & bs_mask) {
fcbd83ffa72af1e SelvaKumar S 2021-02-08 351 return -EINVAL;
^^^^^^^^^^^^^^^
fcbd83ffa72af1e SelvaKumar S 2021-02-08 @352 goto out;
^^^^^^^^
Memory leak of "payload".
fcbd83ffa72af1e SelvaKumar S 2021-02-08 353 }
fcbd83ffa72af1e SelvaKumar S 2021-02-08 354 dest_sect = dest >> SECTOR_SHIFT;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 355
fcbd83ffa72af1e SelvaKumar S 2021-02-08 356 if (bdev == dest_bdev && q->limits.copy_offload) {
fcbd83ffa72af1e SelvaKumar S 2021-02-08 357 ret = blk_copy_offload(bdev, payload, dest_sect, gfp_mask);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 358 if (ret)
fcbd83ffa72af1e SelvaKumar S 2021-02-08 359 goto out;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 360 } else {
fcbd83ffa72af1e SelvaKumar S 2021-02-08 361 ret = blk_read_to_buf(bdev, payload, gfp_mask, &buf);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 362 if (ret)
fcbd83ffa72af1e SelvaKumar S 2021-02-08 363 goto out;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 364 ret = blk_write_from_buf(dest_bdev, buf, dest_sect,
fcbd83ffa72af1e SelvaKumar S 2021-02-08 365 payload->copy_size << SECTOR_SHIFT, gfp_mask);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 366 }
fcbd83ffa72af1e SelvaKumar S 2021-02-08 367
fcbd83ffa72af1e SelvaKumar S 2021-02-08 368 if (buf)
fcbd83ffa72af1e SelvaKumar S 2021-02-08 369 kvfree(buf);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 370 out:
fcbd83ffa72af1e SelvaKumar S 2021-02-08 371 kvfree(payload);
fcbd83ffa72af1e SelvaKumar S 2021-02-08 372 return ret;
fcbd83ffa72af1e SelvaKumar S 2021-02-08 373 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 7 months
Re: [PATCH v2 2/2] pinctrl: pinmux: Add pinmux-select debugfs file
by Dan Carpenter
On Wed, Feb 10, 2021 at 11:04:28AM -0800, Drew Fustini wrote:
> On Wed, Feb 10, 2021 at 09:20:44PM +0300, Dan Carpenter wrote:
> > Hi Drew,
> >
> > url: https://github.com/0day-ci/linux/commits/Drew-Fustini/pinctrl-pinmux-Add-...
> > base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
> > config: i386-randconfig-m021-20210209 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp(a)intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
>
> Does it makes sense for me to include that tag in this patch?
>
This stuff is just in the autogenerated portions of the kbuild bot
email. I normally just hit forward, without all the extra pontifying
that I included this time. :P
regards,
dan carpenter
1 year, 7 months
Re: [PATCH v4 net-next 06/11] skbuff: remove __kfree_skb_flush()
by kernel test robot
Hi Alexander,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Alexander-Lobakin/skbuff-introdu...
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git de1db4a6ed6241e34cab0e5059d4b56f6bae39b9
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.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/0day-ci/linux/commit/6bb224307d9f31afa154a8825f9acbd8e...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexander-Lobakin/skbuff-introduce-skbuff_heads-bulking-and-reusing/20210211-004041
git checkout 6bb224307d9f31afa154a8825f9acbd8e9f6b490
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh
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 >>):
net/core/dev.c: In function 'napi_threaded_poll':
>> net/core/dev.c:7012:4: error: implicit declaration of function '__kfree_skb_flush'; did you mean '__kfree_skb_defer'? [-Werror=implicit-function-declaration]
7012 | __kfree_skb_flush();
| ^~~~~~~~~~~~~~~~~
| __kfree_skb_defer
cc1: some warnings being treated as errors
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for SND_ATMEL_SOC_PDC
Depends on SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && HAS_DMA
Selected by
- SND_ATMEL_SOC_SSC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC
- SND_ATMEL_SOC_SSC_PDC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && ATMEL_SSC
vim +7012 net/core/dev.c
29863d41bb6e1d Wei Wang 2021-02-08 6996
29863d41bb6e1d Wei Wang 2021-02-08 6997 static int napi_threaded_poll(void *data)
29863d41bb6e1d Wei Wang 2021-02-08 6998 {
29863d41bb6e1d Wei Wang 2021-02-08 6999 struct napi_struct *napi = data;
29863d41bb6e1d Wei Wang 2021-02-08 7000 void *have;
29863d41bb6e1d Wei Wang 2021-02-08 7001
29863d41bb6e1d Wei Wang 2021-02-08 7002 while (!napi_thread_wait(napi)) {
29863d41bb6e1d Wei Wang 2021-02-08 7003 for (;;) {
29863d41bb6e1d Wei Wang 2021-02-08 7004 bool repoll = false;
29863d41bb6e1d Wei Wang 2021-02-08 7005
29863d41bb6e1d Wei Wang 2021-02-08 7006 local_bh_disable();
29863d41bb6e1d Wei Wang 2021-02-08 7007
29863d41bb6e1d Wei Wang 2021-02-08 7008 have = netpoll_poll_lock(napi);
29863d41bb6e1d Wei Wang 2021-02-08 7009 __napi_poll(napi, &repoll);
29863d41bb6e1d Wei Wang 2021-02-08 7010 netpoll_poll_unlock(have);
29863d41bb6e1d Wei Wang 2021-02-08 7011
29863d41bb6e1d Wei Wang 2021-02-08 @7012 __kfree_skb_flush();
29863d41bb6e1d Wei Wang 2021-02-08 7013 local_bh_enable();
29863d41bb6e1d Wei Wang 2021-02-08 7014
29863d41bb6e1d Wei Wang 2021-02-08 7015 if (!repoll)
29863d41bb6e1d Wei Wang 2021-02-08 7016 break;
29863d41bb6e1d Wei Wang 2021-02-08 7017
29863d41bb6e1d Wei Wang 2021-02-08 7018 cond_resched();
29863d41bb6e1d Wei Wang 2021-02-08 7019 }
29863d41bb6e1d Wei Wang 2021-02-08 7020 }
29863d41bb6e1d Wei Wang 2021-02-08 7021 return 0;
29863d41bb6e1d Wei Wang 2021-02-08 7022 }
29863d41bb6e1d Wei Wang 2021-02-08 7023
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 7 months
[PATCH] dm writecache: fix flexible_array.cocci warnings
by Julia Lawall
Zero-length and one-element arrays are deprecated, see
Documentation/process/deprecated.rst
Flexible-array members should be used instead.
Generated by: scripts/coccinelle/misc/flexible_array.cocci
CC: Denis Efremov <efremov(a)linux.com>
Reported-by: kernel test robot <lkp(a)intel.com>
Signed-off-by: kernel test robot <lkp(a)intel.com>
Signed-off-by: Julia Lawall <julia.lawall(a)inria.fr>
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e0756cfc7d7cd08c98a53b6009c091a3f6a50be6
commit: 7b36c1398fb63f9c38cc83dc75f143d2e5995062 coccinelle: misc: add flexible_array.cocci script
:::::: branch date: 2 days ago
:::::: commit date: 4 months ago
dm-writecache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -73,7 +73,7 @@ struct wc_memory_superblock {
};
__le64 padding[8];
};
- struct wc_memory_entry entries[0];
+ struct wc_memory_entry entries[];
};
struct wc_entry {
1 year, 7 months
Re: [PATCH] clk: Mark fwnodes when their clock provider is added
by kernel test robot
Hi Tudor,
I love your patch! Yet something to improve:
[auto build test ERROR on clk/clk-next]
[also build test ERROR on v5.11-rc7 next-20210125]
[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/Tudor-Ambarus/clk-Mark-fwnodes-w...
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: nds32-randconfig-r014-20210209 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.3.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/0day-ci/linux/commit/383fe519868d52331467f2a7f00c0cf25...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tudor-Ambarus/clk-Mark-fwnodes-when-their-clock-provider-is-added/20210210-195223
git checkout 383fe519868d52331467f2a7f00c0cf258ea142d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32
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 >>):
drivers/clk/clk.c: In function 'of_clk_add_hw_provider':
>> drivers/clk/clk.c:4595:2: error: implicit declaration of function 'fwnode_dev_initialized'; did you mean 'zone_is_initialized'? [-Werror=implicit-function-declaration]
4595 | fwnode_dev_initialized(&np->fwnode, true);
| ^~~~~~~~~~~~~~~~~~~~~~
| zone_is_initialized
cc1: some warnings being treated as errors
vim +4595 drivers/clk/clk.c
4561
4562 /**
4563 * of_clk_add_hw_provider() - Register a clock provider for a node
4564 * @np: Device node pointer associated with clock provider
4565 * @get: callback for decoding clk_hw
4566 * @data: context pointer for @get callback.
4567 */
4568 int of_clk_add_hw_provider(struct device_node *np,
4569 struct clk_hw *(*get)(struct of_phandle_args *clkspec,
4570 void *data),
4571 void *data)
4572 {
4573 struct of_clk_provider *cp;
4574 int ret;
4575
4576 cp = kzalloc(sizeof(*cp), GFP_KERNEL);
4577 if (!cp)
4578 return -ENOMEM;
4579
4580 cp->node = of_node_get(np);
4581 cp->data = data;
4582 cp->get_hw = get;
4583
4584 mutex_lock(&of_clk_mutex);
4585 list_add(&cp->link, &of_clk_providers);
4586 mutex_unlock(&of_clk_mutex);
4587 pr_debug("Added clk_hw provider from %pOF\n", np);
4588
4589 clk_core_reparent_orphans();
4590
4591 ret = of_clk_set_defaults(np, true);
4592 if (ret < 0)
4593 of_clk_del_provider(np);
4594
> 4595 fwnode_dev_initialized(&np->fwnode, true);
4596
4597 return ret;
4598 }
4599 EXPORT_SYMBOL_GPL(of_clk_add_hw_provider);
4600
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 7 months
[chao-linux:simple_copy 5/5] fs/f2fs/data.c:593 __submit_copy_bio() warn: inconsistent indenting
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git simple_copy
head: d6f32b90156624ae9dc06ef5873334a48e9b9806
commit: d6f32b90156624ae9dc06ef5873334a48e9b9806 [5/5] f2fs: use BLK_COPY ioctl for gc.
config: xtensa-randconfig-m031-20210209 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
New smatch warnings:
fs/f2fs/data.c:593 __submit_copy_bio() warn: inconsistent indenting
fs/f2fs/data.c:607 __submit_copy_bio() warn: should '(fio->old_blkaddr - (sbi->devs[i]).start_blk) << 12' be a 64 bit type?
fs/f2fs/data.c:609 __submit_copy_bio() warn: should '(fio->new_blkaddr - (sbi->devs[i]).start_blk) << 12' be a 64 bit type?
Old smatch warnings:
arch/xtensa/include/asm/thread_info.h:91 current_thread_info() warn: inconsistent indenting
fs/f2fs/data.c:611 __submit_copy_bio() warn: inconsistent indenting
fs/f2fs/data.c:2257 f2fs_read_multi_pages() warn: missing error code 'ret'
vim +593 fs/f2fs/data.c
573
574 /**
575 * __submit_copy_bio - issue BLK_COPY,
576 * BLK_COPY copies fio->old_blkaddr to fio->new_blkaddr
577 */
578
579 static int __submit_copy_bio(struct f2fs_io_info *fio)
580 {
581 struct f2fs_sb_info *sbi = fio->sbi;
582 struct block_device *bdev = f2fs_target_device(fio->sbi, fio->old_blkaddr, NULL);
583 struct block_device *bdev2 = f2fs_target_device(fio->sbi, fio->new_blkaddr, NULL);
584 int ret = 0, i;
585 struct range_entry rlist;
586
587 if (bdev != bdev2)
588 return -EAGAIN;
589
590 /*TODO: temp error checks, need to figure out for different devices how to handle */
591 if (!fio->old_blkaddr) {
592 printk("%s:%s:%d: old_blkaddr NULL \n", __FILE__, __func__, __LINE__);
> 593 BUG();
594 } else if (!fio->new_blkaddr) {
595 printk("%s:%s:%d: new_blkaddr NULL \n", __FILE__, __func__, __LINE__);
596 BUG();
597 } else if (!f2fs_target_device_index(fio->sbi, fio->old_blkaddr)) {
598 printk("%s:%s:%d: old_blkaddr device is CNS\n", __FILE__, __func__, __LINE__);
599 BUG();
600 } else if (!f2fs_target_device_index(fio->sbi, fio->new_blkaddr)) {
601 printk("%s:%s:%d: new_blkaddr device is CNS\n", __FILE__, __func__, __LINE__);
602 BUG();
603 }
604
605 i = f2fs_target_device_index(fio->sbi, fio->old_blkaddr);
606
> 607 rlist.src = (fio->old_blkaddr - FDEV(i).start_blk) << 12;
608 rlist.len = PAGE_SIZE;
> 609 ret = blkdev_issue_copy(bdev, 1, &rlist, bdev, (fio->new_blkaddr - FDEV(i).start_blk) << 12, 0);
610
611 return ret;
612 }
613
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 7 months
[djwong-xfs:realtime-reflink-extsize 275/296] fs/xfs/xfs_reflink.c:622:16: warning: variable 'qflag' set but not used
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git realtime-reflink-extsize
head: 6337b08dd02c0227dc3781b82b1a8cf6cf9b4fe9
commit: cc7af6fdf9d2c4cf0ab7fd1cdd2332d90f610acf [275/296] xfs: enable CoW for realtime data
config: parisc-randconfig-r023-20210209 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.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://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/comm...
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git fetch --no-tags djwong-xfs realtime-reflink-extsize
git checkout cc7af6fdf9d2c4cf0ab7fd1cdd2332d90f610acf
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
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 >>):
fs/xfs/xfs_reflink.c: In function 'xfs_reflink_end_cow_extent':
>> fs/xfs/xfs_reflink.c:622:16: warning: variable 'qflag' set but not used [-Wunused-but-set-variable]
622 | unsigned int qflag;
| ^~~~~
vim +/qflag +622 fs/xfs/xfs_reflink.c
598
599 /*
600 * Remap part of the CoW fork into the data fork.
601 *
602 * We aim to remap the range starting at @offset_fsb and ending at @end_fsb
603 * into the data fork; this function will remap what it can (at the end of the
604 * range) and update @end_fsb appropriately. Each remap gets its own
605 * transaction because we can end up merging and splitting bmbt blocks for
606 * every remap operation and we'd like to keep the block reservation
607 * requirements as low as possible.
608 */
609 STATIC int
610 xfs_reflink_end_cow_extent(
611 struct xfs_inode *ip,
612 xfs_fileoff_t offset_fsb,
613 xfs_fileoff_t *end_fsb)
614 {
615 struct xfs_bmbt_irec got, del;
616 struct xfs_iext_cursor icur;
617 struct xfs_mount *mp = ip->i_mount;
618 struct xfs_trans *tp;
619 struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
620 xfs_filblks_t rlen;
621 unsigned int resblks;
> 622 unsigned int qflag;
623 int error;
624
625 /* No COW extents? That's easy! */
626 if (ifp->if_bytes == 0) {
627 *end_fsb = offset_fsb;
628 return 0;
629 }
630
631 resblks = XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK);
632 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0,
633 XFS_TRANS_RESERVE, &tp);
634 if (error)
635 return error;
636
637 /*
638 * Lock the inode. We have to ijoin without automatic unlock because
639 * the lead transaction is the refcountbt record deletion; the data
640 * fork update follows as a deferred log item.
641 */
642 xfs_ilock(ip, XFS_ILOCK_EXCL);
643 xfs_trans_ijoin(tp, ip, 0);
644
645 /*
646 * In case of racing, overlapping AIO writes no COW extents might be
647 * left by the time I/O completes for the loser of the race. In that
648 * case we are done.
649 */
650 if (!xfs_iext_lookup_extent_before(ip, ifp, end_fsb, &icur, &got) ||
651 got.br_startoff + got.br_blockcount <= offset_fsb) {
652 *end_fsb = offset_fsb;
653 goto out_cancel;
654 }
655
656 /*
657 * Structure copy @got into @del, then trim @del to the range that we
658 * were asked to remap. We preserve @got for the eventual CoW fork
659 * deletion; from now on @del represents the mapping that we're
660 * actually remapping.
661 */
662 del = got;
663 xfs_trim_extent(&del, offset_fsb, *end_fsb - offset_fsb);
664
665 ASSERT(del.br_blockcount > 0);
666
667 /*
668 * Only remap real extents that contain data. With AIO, speculative
669 * preallocations can leak into the range we are called upon, and we
670 * need to skip them.
671 */
672 if (!xfs_bmap_is_written_extent(&got)) {
673 *end_fsb = del.br_startoff;
674 goto out_cancel;
675 }
676
677 /* Unmap the old blocks in the data fork. */
678 rlen = del.br_blockcount;
679 error = __xfs_bunmapi(tp, ip, del.br_startoff, &rlen, 0, 1);
680 if (error)
681 goto out_cancel;
682
683 /* Trim the extent to whatever got unmapped. */
684 xfs_trim_extent(&del, del.br_startoff + rlen, del.br_blockcount - rlen);
685 trace_xfs_reflink_cow_remap(ip, &del);
686
687 /* Free the CoW orphan record. */
688 xfs_refcount_free_cow_extent(tp, del.br_startblock, del.br_blockcount,
689 XFS_IS_REALTIME_INODE(ip));
690
691 /* Map the new blocks into the data fork. */
692 xfs_bmap_map_extent(tp, ip, XFS_DATA_FORK, &del);
693
694 /* Charge this new data fork mapping to the on-disk quota. */
695 qflag = XFS_IS_REALTIME_INODE(ip) ? XFS_TRANS_DQ_DELRTBCOUNT :
696 XFS_TRANS_DQ_DELBCOUNT;
697 xfs_trans_mod_dquot_byino(tp, ip, qflag, (long)del.br_blockcount);
698
699 /* Remove the mapping from the CoW fork. */
700 xfs_bmap_del_extent_cow(ip, &icur, &got, &del);
701
702 error = xfs_trans_commit(tp);
703 xfs_iunlock(ip, XFS_ILOCK_EXCL);
704 if (error)
705 return error;
706
707 /* Update the caller about how much progress we made. */
708 *end_fsb = del.br_startoff;
709 return 0;
710
711 out_cancel:
712 xfs_trans_cancel(tp);
713 xfs_iunlock(ip, XFS_ILOCK_EXCL);
714 return error;
715 }
716
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 7 months
Re: [PATCH v2 2/2] pinctrl: pinmux: Add pinmux-select debugfs file
by Dan Carpenter
Hi Drew,
url: https://github.com/0day-ci/linux/commits/Drew-Fustini/pinctrl-pinmux-Add-...
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: i386-randconfig-m021-20210209 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/pinctrl/pinmux.c:762 pinmux_select() error: uninitialized symbol 'gname'.
vim +/gname +762 drivers/pinctrl/pinmux.c
99b2f99aa41aa7 Drew Fustini 2021-02-09 678 static ssize_t pinmux_select(struct file *file, const char __user *user_buf,
99b2f99aa41aa7 Drew Fustini 2021-02-09 679 size_t len, loff_t *ppos)
99b2f99aa41aa7 Drew Fustini 2021-02-09 680 {
99b2f99aa41aa7 Drew Fustini 2021-02-09 681 struct seq_file *sfile = file->private_data;
99b2f99aa41aa7 Drew Fustini 2021-02-09 682 struct pinctrl_dev *pctldev = sfile->private;
99b2f99aa41aa7 Drew Fustini 2021-02-09 683 const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
99b2f99aa41aa7 Drew Fustini 2021-02-09 684 const char *const *groups;
99b2f99aa41aa7 Drew Fustini 2021-02-09 685 char *buf, *fname, *gname;
99b2f99aa41aa7 Drew Fustini 2021-02-09 686 unsigned int num_groups;
99b2f99aa41aa7 Drew Fustini 2021-02-09 687 int fsel, gsel, ret;
99b2f99aa41aa7 Drew Fustini 2021-02-09 688
99b2f99aa41aa7 Drew Fustini 2021-02-09 689 if (len > (PINMUX_MAX_NAME * 2)) {
99b2f99aa41aa7 Drew Fustini 2021-02-09 690 dev_err(pctldev->dev, "write too big for buffer");
99b2f99aa41aa7 Drew Fustini 2021-02-09 691 return -EINVAL;
99b2f99aa41aa7 Drew Fustini 2021-02-09 692 }
99b2f99aa41aa7 Drew Fustini 2021-02-09 693
99b2f99aa41aa7 Drew Fustini 2021-02-09 694 buf = devm_kzalloc(pctldev->dev, PINMUX_MAX_NAME * 2, GFP_KERNEL);
99b2f99aa41aa7 Drew Fustini 2021-02-09 695 if (!buf)
99b2f99aa41aa7 Drew Fustini 2021-02-09 696 return -ENOMEM;
99b2f99aa41aa7 Drew Fustini 2021-02-09 697
99b2f99aa41aa7 Drew Fustini 2021-02-09 698 fname = devm_kzalloc(pctldev->dev, PINMUX_MAX_NAME, GFP_KERNEL);
99b2f99aa41aa7 Drew Fustini 2021-02-09 699 if (!fname) {
99b2f99aa41aa7 Drew Fustini 2021-02-09 700 ret = -ENOMEM;
99b2f99aa41aa7 Drew Fustini 2021-02-09 701 goto free_buf;
The gotos are out of order. They should be in mirror/reverse order of
the allocations:
free_gmane:
devm_kfree(pctldev->dev, gname);
free_fname:
devm_kfree(pctldev->dev, fname);
free_buf:
devm_kfree(pctldev->dev, buf);
But also why do we need to use devm_kfree() at all? I thought the whole
point of devm_ functions was that they are garbage collected
automatically for you. Can we not just delete all error handling and
return -ENOMEM here?
99b2f99aa41aa7 Drew Fustini 2021-02-09 702 }
99b2f99aa41aa7 Drew Fustini 2021-02-09 703
99b2f99aa41aa7 Drew Fustini 2021-02-09 704 gname = devm_kzalloc(pctldev->dev, PINMUX_MAX_NAME, GFP_KERNEL);
99b2f99aa41aa7 Drew Fustini 2021-02-09 705 if (!buf) {
99b2f99aa41aa7 Drew Fustini 2021-02-09 706 ret = -ENOMEM;
99b2f99aa41aa7 Drew Fustini 2021-02-09 707 goto free_fname;
99b2f99aa41aa7 Drew Fustini 2021-02-09 708 }
99b2f99aa41aa7 Drew Fustini 2021-02-09 709
99b2f99aa41aa7 Drew Fustini 2021-02-09 710 ret = strncpy_from_user(buf, user_buf, PINMUX_MAX_NAME * 2);
99b2f99aa41aa7 Drew Fustini 2021-02-09 711 if (ret < 0) {
99b2f99aa41aa7 Drew Fustini 2021-02-09 712 dev_err(pctldev->dev, "failed to copy buffer from userspace");
99b2f99aa41aa7 Drew Fustini 2021-02-09 713 goto free_gname;
99b2f99aa41aa7 Drew Fustini 2021-02-09 714 }
99b2f99aa41aa7 Drew Fustini 2021-02-09 715 buf[len-1] = '\0';
99b2f99aa41aa7 Drew Fustini 2021-02-09 716
99b2f99aa41aa7 Drew Fustini 2021-02-09 717 ret = sscanf(buf, "%s %s", fname, gname);
99b2f99aa41aa7 Drew Fustini 2021-02-09 718 if (ret != 2) {
99b2f99aa41aa7 Drew Fustini 2021-02-09 719 dev_err(pctldev->dev, "expected format: <function-name> <group-name>");
99b2f99aa41aa7 Drew Fustini 2021-02-09 720 goto free_gname;
99b2f99aa41aa7 Drew Fustini 2021-02-09 721 }
99b2f99aa41aa7 Drew Fustini 2021-02-09 722
99b2f99aa41aa7 Drew Fustini 2021-02-09 723 fsel = pinmux_func_name_to_selector(pctldev, fname);
99b2f99aa41aa7 Drew Fustini 2021-02-09 724 if (fsel < 0) {
99b2f99aa41aa7 Drew Fustini 2021-02-09 725 dev_err(pctldev->dev, "invalid function %s in map table\n", fname);
99b2f99aa41aa7 Drew Fustini 2021-02-09 726 ret = -EINVAL;
99b2f99aa41aa7 Drew Fustini 2021-02-09 727 goto free_gname;
99b2f99aa41aa7 Drew Fustini 2021-02-09 728 }
99b2f99aa41aa7 Drew Fustini 2021-02-09 729
99b2f99aa41aa7 Drew Fustini 2021-02-09 730 ret = pmxops->get_function_groups(pctldev, fsel, &groups, &num_groups);
99b2f99aa41aa7 Drew Fustini 2021-02-09 731 if (ret) {
99b2f99aa41aa7 Drew Fustini 2021-02-09 732 dev_err(pctldev->dev, "no groups for function %d (%s)", fsel, fname);
99b2f99aa41aa7 Drew Fustini 2021-02-09 733 goto free_gname;
99b2f99aa41aa7 Drew Fustini 2021-02-09 734
99b2f99aa41aa7 Drew Fustini 2021-02-09 735 }
99b2f99aa41aa7 Drew Fustini 2021-02-09 736
99b2f99aa41aa7 Drew Fustini 2021-02-09 737 ret = match_string(groups, num_groups, gname);
99b2f99aa41aa7 Drew Fustini 2021-02-09 738 if (ret < 0) {
99b2f99aa41aa7 Drew Fustini 2021-02-09 739 dev_err(pctldev->dev, "invalid group %s", gname);
99b2f99aa41aa7 Drew Fustini 2021-02-09 740 goto free_gname;
99b2f99aa41aa7 Drew Fustini 2021-02-09 741 }
99b2f99aa41aa7 Drew Fustini 2021-02-09 742
99b2f99aa41aa7 Drew Fustini 2021-02-09 743 ret = pinctrl_get_group_selector(pctldev, gname);
99b2f99aa41aa7 Drew Fustini 2021-02-09 744 if (ret < 0) {
99b2f99aa41aa7 Drew Fustini 2021-02-09 745 dev_err(pctldev->dev, "failed to get group selectorL %s", gname);
99b2f99aa41aa7 Drew Fustini 2021-02-09 746 goto free_gname;
99b2f99aa41aa7 Drew Fustini 2021-02-09 747 }
99b2f99aa41aa7 Drew Fustini 2021-02-09 748 gsel = ret;
99b2f99aa41aa7 Drew Fustini 2021-02-09 749
99b2f99aa41aa7 Drew Fustini 2021-02-09 750 ret = pmxops->set_mux(pctldev, fsel, gsel);
99b2f99aa41aa7 Drew Fustini 2021-02-09 751 if (ret) {
99b2f99aa41aa7 Drew Fustini 2021-02-09 752 dev_err(pctldev->dev, "set_mux() failed: %d", ret);
99b2f99aa41aa7 Drew Fustini 2021-02-09 753 goto free_gname;
99b2f99aa41aa7 Drew Fustini 2021-02-09 754 }
99b2f99aa41aa7 Drew Fustini 2021-02-09 755
99b2f99aa41aa7 Drew Fustini 2021-02-09 756 return len;
99b2f99aa41aa7 Drew Fustini 2021-02-09 757 free_buf:
99b2f99aa41aa7 Drew Fustini 2021-02-09 758 devm_kfree(pctldev->dev, buf);
99b2f99aa41aa7 Drew Fustini 2021-02-09 759 free_fname:
99b2f99aa41aa7 Drew Fustini 2021-02-09 760 devm_kfree(pctldev->dev, fname);
99b2f99aa41aa7 Drew Fustini 2021-02-09 761 free_gname:
99b2f99aa41aa7 Drew Fustini 2021-02-09 @762 devm_kfree(pctldev->dev, gname);
99b2f99aa41aa7 Drew Fustini 2021-02-09 763 return ret;
99b2f99aa41aa7 Drew Fustini 2021-02-09 764 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 7 months