arch/powerpc/platforms/powernv/pci-sriov.c:606:12: warning: Either the condition '!iov' is redundant or there is possible null pointer dereference: iov.
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Oliver O'Halloran" <oohall(a)gmail.com>
CC: Michael Ellerman <mpe(a)ellerman.id.au>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b65054597872ce3aefbc6a666385eabdf9e288da
commit: 052da31d45fc71238ea8bed7e9a84648a1ee0bf3 powerpc/powernv/sriov: De-indent setup and teardown
date: 4 months ago
:::::: branch date: 22 hours ago
:::::: commit date: 4 months ago
compiler: powerpc64le-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>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> arch/powerpc/platforms/powernv/pci-sriov.c:606:12: warning: Either the condition '!iov' is redundant or there is possible null pointer dereference: iov. [nullPointerRedundantCheck]
num_vfs = iov->num_vfs;
^
arch/powerpc/platforms/powernv/pci-sriov.c:609:14: note: Assuming that condition '!iov' is not redundant
if (WARN_ON(!iov))
^
arch/powerpc/platforms/powernv/pci-sriov.c:606:12: note: Null pointer dereference
num_vfs = iov->num_vfs;
^
arch/powerpc/platforms/powernv/pci-sriov.c:607:12: warning: Either the condition '!iov' is redundant or there is possible null pointer dereference: iov. [nullPointerRedundantCheck]
base_pe = iov->vf_pe_arr[0].pe_number;
^
arch/powerpc/platforms/powernv/pci-sriov.c:609:14: note: Assuming that condition '!iov' is not redundant
if (WARN_ON(!iov))
^
arch/powerpc/platforms/powernv/pci-sriov.c:607:12: note: Null pointer dereference
base_pe = iov->vf_pe_arr[0].pe_number;
^
vim +606 arch/powerpc/platforms/powernv/pci-sriov.c
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 597
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 598 static void pnv_pci_sriov_disable(struct pci_dev *pdev)
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 599 {
d29a2488d2c0200 Oliver O'Halloran 2020-07-22 600 u16 num_vfs, base_pe;
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 601 struct pnv_phb *phb;
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 602 struct pnv_iov_data *iov;
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 603
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 604 phb = pci_bus_to_pnvhb(pdev->bus);
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 605 iov = pnv_iov_get(pdev);
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 @606 num_vfs = iov->num_vfs;
d29a2488d2c0200 Oliver O'Halloran 2020-07-22 607 base_pe = iov->vf_pe_arr[0].pe_number;
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 608
052da31d45fc712 Oliver O'Halloran 2020-07-22 609 if (WARN_ON(!iov))
052da31d45fc712 Oliver O'Halloran 2020-07-22 610 return;
052da31d45fc712 Oliver O'Halloran 2020-07-22 611
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 612 /* Release VF PEs */
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 613 pnv_ioda_release_vf_PE(pdev);
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 614
052da31d45fc712 Oliver O'Halloran 2020-07-22 615 /* Un-shift the IOV BAR resources */
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 616 if (!iov->m64_single_mode)
d29a2488d2c0200 Oliver O'Halloran 2020-07-22 617 pnv_pci_vf_resource_shift(pdev, -base_pe);
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 618
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 619 /* Release M64 windows */
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 620 pnv_pci_vf_release_m64(pdev, num_vfs);
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 621 }
37b59ef08c546c6 Oliver O'Halloran 2020-07-22 622
:::::: The code at line 606 was first introduced by commit
:::::: 37b59ef08c546c6f54cdc52eed749f494619a102 powerpc/powernv/sriov: Move SR-IOV into a separate file
:::::: TO: Oliver O'Halloran <oohall(a)gmail.com>
:::::: CC: Michael Ellerman <mpe(a)ellerman.id.au>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 months, 4 weeks
drivers/perf/fsl_imx8_ddr_perf.c:119:8-16: WARNING: use scnprintf or sprintf
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Denis Efremov <efremov(a)linux.com>
CC: Julia Lawall <Julia.Lawall(a)lip6.fr>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b65054597872ce3aefbc6a666385eabdf9e288da
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script
date: 4 months ago
:::::: branch date: 22 hours ago
:::::: commit date: 4 months ago
config: arm-randconfig-c003-20201130 (attached as .config)
compiler: arm-linux-gnueabi-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: Julia Lawall <julia.lawall(a)lip6.fr>
"coccinelle warnings: (new ones prefixed by >>)"
>> drivers/perf/fsl_imx8_ddr_perf.c:119:8-16: WARNING: use scnprintf or sprintf
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 months, 4 weeks
Re: [PATCH 06/18] software_node: amend software_node_unregister_node_group() to perform unregistration of array in reverse order to be consistent with software_node_unregister_nodes()
by kernel test robot
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20201130133129.1024662-7-djrscally(a)gmail.com>
References: <20201130133129.1024662-7-djrscally(a)gmail.com>
TO: Daniel Scally <djrscally(a)gmail.com>
TO: linux-kernel(a)vger.kernel.org
TO: linux-acpi(a)vger.kernel.org
TO: linux-gpio(a)vger.kernel.org
TO: linux-i2c(a)vger.kernel.org
TO: linux-media(a)vger.kernel.org
TO: devel(a)acpica.org
CC: rjw(a)rjwysocki.net
CC: lenb(a)kernel.org
CC: gregkh(a)linuxfoundation.org
CC: mika.westerberg(a)linux.intel.com
Hi Daniel,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on driver-core/driver-core-testing pm/linux-next v5.10-rc6 next-20201130]
[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/Daniel-Scally/Add-functionality-...
base: git://linuxtv.org/media_tree.git master
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: i386-randconfig-m021-20201130 (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/base/swnode.c:785 software_node_unregister_node_group() error: uninitialized symbol 'i'.
vim +/i +785 drivers/base/swnode.c
02094d54870590a Andy Shevchenko 2020-04-08 771
02094d54870590a Andy Shevchenko 2020-04-08 772 /**
02094d54870590a Andy Shevchenko 2020-04-08 773 * software_node_unregister_node_group - Unregister a group of software nodes
02094d54870590a Andy Shevchenko 2020-04-08 774 * @node_group: NULL terminated array of software node pointers to be unregistered
02094d54870590a Andy Shevchenko 2020-04-08 775 *
02094d54870590a Andy Shevchenko 2020-04-08 776 * Unregister multiple software nodes at once.
02094d54870590a Andy Shevchenko 2020-04-08 777 */
02094d54870590a Andy Shevchenko 2020-04-08 778 void software_node_unregister_node_group(const struct software_node **node_group)
02094d54870590a Andy Shevchenko 2020-04-08 779 {
02094d54870590a Andy Shevchenko 2020-04-08 780 unsigned int i;
02094d54870590a Andy Shevchenko 2020-04-08 781
02094d54870590a Andy Shevchenko 2020-04-08 782 if (!node_group)
02094d54870590a Andy Shevchenko 2020-04-08 783 return;
02094d54870590a Andy Shevchenko 2020-04-08 784
7c7577c82672f0a Daniel Scally 2020-11-30 @785 while (node_group[i]->name)
7c7577c82672f0a Daniel Scally 2020-11-30 786 i++;
7c7577c82672f0a Daniel Scally 2020-11-30 787
7c7577c82672f0a Daniel Scally 2020-11-30 788 while (i--)
9dcbac84244f32e Andy Shevchenko 2020-06-22 789 software_node_unregister(node_group[i]);
02094d54870590a Andy Shevchenko 2020-04-08 790 }
02094d54870590a Andy Shevchenko 2020-04-08 791 EXPORT_SYMBOL_GPL(software_node_unregister_node_group);
02094d54870590a Andy Shevchenko 2020-04-08 792
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 months, 4 weeks
drivers/gpu/drm/tegra/plane.c:154 tegra_dc_pin() error: uninitialized symbol 'phys_addr'.
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Thierry Reding <treding(a)nvidia.com>
CC: Dmitry Osipenko <digetx(a)gmail.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b65054597872ce3aefbc6a666385eabdf9e288da
commit: 273da5a046965ccf0ec79eb63f2d5173467e20fa drm/tegra: Reuse IOVA mapping where possible
date: 10 months ago
:::::: branch date: 16 hours ago
:::::: commit date: 10 months ago
config: arm64-randconfig-m031-20201130 (attached as .config)
compiler: aarch64-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:
drivers/gpu/drm/tegra/plane.c:154 tegra_dc_pin() error: uninitialized symbol 'phys_addr'.
vim +/phys_addr +154 drivers/gpu/drm/tegra/plane.c
5acd3514273611 Thierry Reding 2017-11-10 109
2e8d8749f6f9bb Thierry Reding 2019-10-28 110 static int tegra_dc_pin(struct tegra_dc *dc, struct tegra_plane_state *state)
2e8d8749f6f9bb Thierry Reding 2019-10-28 111 {
273da5a046965c Thierry Reding 2020-02-04 112 struct iommu_domain *domain = iommu_get_domain_for_dev(dc->dev);
2e8d8749f6f9bb Thierry Reding 2019-10-28 113 unsigned int i;
2e8d8749f6f9bb Thierry Reding 2019-10-28 114 int err;
2e8d8749f6f9bb Thierry Reding 2019-10-28 115
2e8d8749f6f9bb Thierry Reding 2019-10-28 116 for (i = 0; i < state->base.fb->format->num_planes; i++) {
2e8d8749f6f9bb Thierry Reding 2019-10-28 117 struct tegra_bo *bo = tegra_fb_get_plane(state->base.fb, i);
273da5a046965c Thierry Reding 2020-02-04 118 dma_addr_t phys_addr, *phys;
2e8d8749f6f9bb Thierry Reding 2019-10-28 119 struct sg_table *sgt;
2e8d8749f6f9bb Thierry Reding 2019-10-28 120
273da5a046965c Thierry Reding 2020-02-04 121 if (!domain || dc->client.group)
273da5a046965c Thierry Reding 2020-02-04 122 phys = &phys_addr;
273da5a046965c Thierry Reding 2020-02-04 123 else
273da5a046965c Thierry Reding 2020-02-04 124 phys = NULL;
273da5a046965c Thierry Reding 2020-02-04 125
273da5a046965c Thierry Reding 2020-02-04 126 sgt = host1x_bo_pin(dc->dev, &bo->base, phys);
2e8d8749f6f9bb Thierry Reding 2019-10-28 127 if (IS_ERR(sgt)) {
2e8d8749f6f9bb Thierry Reding 2019-10-28 128 err = PTR_ERR(sgt);
2e8d8749f6f9bb Thierry Reding 2019-10-28 129 goto unpin;
2e8d8749f6f9bb Thierry Reding 2019-10-28 130 }
2e8d8749f6f9bb Thierry Reding 2019-10-28 131
273da5a046965c Thierry Reding 2020-02-04 132 if (sgt) {
2e8d8749f6f9bb Thierry Reding 2019-10-28 133 err = dma_map_sg(dc->dev, sgt->sgl, sgt->nents,
2e8d8749f6f9bb Thierry Reding 2019-10-28 134 DMA_TO_DEVICE);
2e8d8749f6f9bb Thierry Reding 2019-10-28 135 if (err == 0) {
2e8d8749f6f9bb Thierry Reding 2019-10-28 136 err = -ENOMEM;
2e8d8749f6f9bb Thierry Reding 2019-10-28 137 goto unpin;
2e8d8749f6f9bb Thierry Reding 2019-10-28 138 }
2e8d8749f6f9bb Thierry Reding 2019-10-28 139
49f821919bb9d4 Thierry Reding 2019-12-03 140 /*
49f821919bb9d4 Thierry Reding 2019-12-03 141 * The display controller needs contiguous memory, so
49f821919bb9d4 Thierry Reding 2019-12-03 142 * fail if the buffer is discontiguous and we fail to
49f821919bb9d4 Thierry Reding 2019-12-03 143 * map its SG table to a single contiguous chunk of
49f821919bb9d4 Thierry Reding 2019-12-03 144 * I/O virtual memory.
49f821919bb9d4 Thierry Reding 2019-12-03 145 */
49f821919bb9d4 Thierry Reding 2019-12-03 146 if (err > 1) {
49f821919bb9d4 Thierry Reding 2019-12-03 147 err = -EINVAL;
49f821919bb9d4 Thierry Reding 2019-12-03 148 goto unpin;
49f821919bb9d4 Thierry Reding 2019-12-03 149 }
49f821919bb9d4 Thierry Reding 2019-12-03 150
2e8d8749f6f9bb Thierry Reding 2019-10-28 151 state->iova[i] = sg_dma_address(sgt->sgl);
2e8d8749f6f9bb Thierry Reding 2019-10-28 152 state->sgt[i] = sgt;
2e8d8749f6f9bb Thierry Reding 2019-10-28 153 } else {
273da5a046965c Thierry Reding 2020-02-04 @154 state->iova[i] = phys_addr;
2e8d8749f6f9bb Thierry Reding 2019-10-28 155 }
2e8d8749f6f9bb Thierry Reding 2019-10-28 156 }
2e8d8749f6f9bb Thierry Reding 2019-10-28 157
2e8d8749f6f9bb Thierry Reding 2019-10-28 158 return 0;
2e8d8749f6f9bb Thierry Reding 2019-10-28 159
2e8d8749f6f9bb Thierry Reding 2019-10-28 160 unpin:
2e8d8749f6f9bb Thierry Reding 2019-10-28 161 dev_err(dc->dev, "failed to map plane %u: %d\n", i, err);
2e8d8749f6f9bb Thierry Reding 2019-10-28 162
2e8d8749f6f9bb Thierry Reding 2019-10-28 163 while (i--) {
2e8d8749f6f9bb Thierry Reding 2019-10-28 164 struct tegra_bo *bo = tegra_fb_get_plane(state->base.fb, i);
2e8d8749f6f9bb Thierry Reding 2019-10-28 165 struct sg_table *sgt = state->sgt[i];
2e8d8749f6f9bb Thierry Reding 2019-10-28 166
273da5a046965c Thierry Reding 2020-02-04 167 if (sgt)
273da5a046965c Thierry Reding 2020-02-04 168 dma_unmap_sg(dc->dev, sgt->sgl, sgt->nents,
273da5a046965c Thierry Reding 2020-02-04 169 DMA_TO_DEVICE);
2e8d8749f6f9bb Thierry Reding 2019-10-28 170
273da5a046965c Thierry Reding 2020-02-04 171 host1x_bo_unpin(dc->dev, &bo->base, sgt);
2e8d8749f6f9bb Thierry Reding 2019-10-28 172 state->iova[i] = DMA_MAPPING_ERROR;
2e8d8749f6f9bb Thierry Reding 2019-10-28 173 state->sgt[i] = NULL;
2e8d8749f6f9bb Thierry Reding 2019-10-28 174 }
2e8d8749f6f9bb Thierry Reding 2019-10-28 175
2e8d8749f6f9bb Thierry Reding 2019-10-28 176 return err;
2e8d8749f6f9bb Thierry Reding 2019-10-28 177 }
2e8d8749f6f9bb Thierry Reding 2019-10-28 178
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 months, 4 weeks
[djwong-xfs:reserve-rt-metadata-space 37/173] fs/xfs/scrub/quotacheck_repair.c:246:9: warning: Identical condition 'error', second condition is always false
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: "Darrick J. Wong" <darrick.wong(a)oracle.com>
TO: "Darrick J. Wong" <darrick.wong(a)oracle.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git reserve-rt-metadata-space
head: a32adbd64a86719b62b97d2b26917850dc374779
commit: fae3e09a8467e1a03c227f7f69590013f8fca75a [37/173] xfs: repair dquots based on live quotacheck results
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago
compiler: sparc64-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>
"cppcheck warnings: (new ones prefixed by >>)"
>> fs/xfs/scrub/repair.c:248:6: warning: Uninitialized variable: freelen [uninitvar]
freelen >= aglen) {
^
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> fs/xfs/xfs_qm_syscalls.c:748:9: warning: Identical condition 'error', second condition is always false [identicalConditionAfterEarlyExit]
return error;
^
fs/xfs/xfs_qm_syscalls.c:739:6: note: first condition
if (error)
^
fs/xfs/xfs_qm_syscalls.c:748:9: note: second condition
return error;
^
>> fs/xfs/scrub/quotacheck_repair.c:246:9: warning: Identical condition 'error', second condition is always false [identicalConditionAfterEarlyExit]
return error;
^
fs/xfs/scrub/quotacheck_repair.c:237:6: note: first condition
if (error)
^
fs/xfs/scrub/quotacheck_repair.c:246:9: note: second condition
return error;
^
--
vim +/error +246 fs/xfs/scrub/quotacheck_repair.c
fae3e09a8467e1a Darrick J. Wong 2020-10-25 191
fae3e09a8467e1a Darrick J. Wong 2020-10-25 192 /* Commit the new dquot counters. */
fae3e09a8467e1a Darrick J. Wong 2020-10-25 193 int
fae3e09a8467e1a Darrick J. Wong 2020-10-25 194 xrep_quotacheck(
fae3e09a8467e1a Darrick J. Wong 2020-10-25 195 struct xfs_scrub *sc)
fae3e09a8467e1a Darrick J. Wong 2020-10-25 196 {
fae3e09a8467e1a Darrick J. Wong 2020-10-25 197 struct xqcheck *xqc = sc->buf;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 198 unsigned int qflags = xqcheck_chkd_flags(sc->mp);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 199 int error;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 200
fae3e09a8467e1a Darrick J. Wong 2020-10-25 201 /*
fae3e09a8467e1a Darrick J. Wong 2020-10-25 202 * Clear the CHKD flag for this quota type and commit the scrub
fae3e09a8467e1a Darrick J. Wong 2020-10-25 203 * transaction so that we can allocate new quota block mappings if we
fae3e09a8467e1a Darrick J. Wong 2020-10-25 204 * have to. If we crash after this point, the sb still has the CHKD
fae3e09a8467e1a Darrick J. Wong 2020-10-25 205 * flags cleared, so mount quotacheck will fix all of this up.
fae3e09a8467e1a Darrick J. Wong 2020-10-25 206 */
fae3e09a8467e1a Darrick J. Wong 2020-10-25 207 spin_lock(&sc->mp->m_sb_lock);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 208 sc->mp->m_qflags &= ~qflags;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 209 sc->mp->m_sb.sb_qflags &= ~qflags;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 210 spin_unlock(&sc->mp->m_sb_lock);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 211 xfs_log_sb(sc->tp);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 212
fae3e09a8467e1a Darrick J. Wong 2020-10-25 213 error = xfs_trans_commit(sc->tp);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 214 sc->tp = NULL;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 215 if (error)
fae3e09a8467e1a Darrick J. Wong 2020-10-25 216 return error;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 217
fae3e09a8467e1a Darrick J. Wong 2020-10-25 218 /* Commit the new counters to the dquots. */
fae3e09a8467e1a Darrick J. Wong 2020-10-25 219 if (xqc->ucounts) {
fae3e09a8467e1a Darrick J. Wong 2020-10-25 220 error = xqcheck_commit_dqtype(xqc, XFS_DQTYPE_USER);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 221 if (error)
fae3e09a8467e1a Darrick J. Wong 2020-10-25 222 return error;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 223 }
fae3e09a8467e1a Darrick J. Wong 2020-10-25 224 if (xqc->gcounts) {
fae3e09a8467e1a Darrick J. Wong 2020-10-25 225 error = xqcheck_commit_dqtype(xqc, XFS_DQTYPE_GROUP);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 226 if (error)
fae3e09a8467e1a Darrick J. Wong 2020-10-25 227 return error;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 228 }
fae3e09a8467e1a Darrick J. Wong 2020-10-25 229 if (xqc->pcounts) {
fae3e09a8467e1a Darrick J. Wong 2020-10-25 230 error = xqcheck_commit_dqtype(xqc, XFS_DQTYPE_PROJ);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 231 if (error)
fae3e09a8467e1a Darrick J. Wong 2020-10-25 232 return error;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 233 }
fae3e09a8467e1a Darrick J. Wong 2020-10-25 234
fae3e09a8467e1a Darrick J. Wong 2020-10-25 235 /* Reinstate CHKD flags. */
fae3e09a8467e1a Darrick J. Wong 2020-10-25 236 error = xchk_trans_alloc(sc, 0);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 237 if (error)
fae3e09a8467e1a Darrick J. Wong 2020-10-25 238 return error;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 239
fae3e09a8467e1a Darrick J. Wong 2020-10-25 240 spin_lock(&sc->mp->m_sb_lock);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 241 sc->mp->m_qflags |= qflags;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 242 sc->mp->m_sb.sb_qflags |= qflags;
fae3e09a8467e1a Darrick J. Wong 2020-10-25 243 spin_unlock(&sc->mp->m_sb_lock);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 244 xfs_log_sb(sc->tp);
fae3e09a8467e1a Darrick J. Wong 2020-10-25 245
fae3e09a8467e1a Darrick J. Wong 2020-10-25 @246 return error;
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 months, 4 weeks
[djwong-xfs:reserve-rt-metadata-space 29/173] fs/xfs/scrub/inode_repair.c:652 xrep_inode() error: we previously assumed 'sc->ip' could be null (see line 633)
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: "Darrick J. Wong" <darrick.wong(a)oracle.com>
TO: "Darrick J. Wong" <darrick.wong(a)oracle.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git reserve-rt-metadata-space
head: a32adbd64a86719b62b97d2b26917850dc374779
commit: a1b62ebe4199926c0055887b9fbb8306d19cd80d [29/173] xfs: repair inode records
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: i386-randconfig-m021-20201130 (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:
fs/xfs/scrub/inode_repair.c:652 xrep_inode() error: we previously assumed 'sc->ip' could be null (see line 633)
vim +652 fs/xfs/scrub/inode_repair.c
a1b62ebe4199926 Darrick J. Wong 2020-10-25 621
a1b62ebe4199926 Darrick J. Wong 2020-10-25 622 /* Repair an inode's fields. */
a1b62ebe4199926 Darrick J. Wong 2020-10-25 623 int
a1b62ebe4199926 Darrick J. Wong 2020-10-25 624 xrep_inode(
a1b62ebe4199926 Darrick J. Wong 2020-10-25 625 struct xfs_scrub *sc)
a1b62ebe4199926 Darrick J. Wong 2020-10-25 626 {
a1b62ebe4199926 Darrick J. Wong 2020-10-25 627 int error = 0;
a1b62ebe4199926 Darrick J. Wong 2020-10-25 628
a1b62ebe4199926 Darrick J. Wong 2020-10-25 629 /*
a1b62ebe4199926 Darrick J. Wong 2020-10-25 630 * No inode? That means we failed the _iget verifiers. Repair all
a1b62ebe4199926 Darrick J. Wong 2020-10-25 631 * the things that the inode verifiers care about, then retry _iget.
a1b62ebe4199926 Darrick J. Wong 2020-10-25 632 */
a1b62ebe4199926 Darrick J. Wong 2020-10-25 @633 if (!sc->ip) {
a1b62ebe4199926 Darrick J. Wong 2020-10-25 634 error = xrep_dinode_problems(sc);
a1b62ebe4199926 Darrick J. Wong 2020-10-25 635 if (error)
a1b62ebe4199926 Darrick J. Wong 2020-10-25 636 goto out;
a1b62ebe4199926 Darrick J. Wong 2020-10-25 637 }
a1b62ebe4199926 Darrick J. Wong 2020-10-25 638
a1b62ebe4199926 Darrick J. Wong 2020-10-25 639 /* By this point we had better have a working incore inode. */
a1b62ebe4199926 Darrick J. Wong 2020-10-25 640 ASSERT(sc->ip);
a1b62ebe4199926 Darrick J. Wong 2020-10-25 641 xfs_trans_ijoin(sc->tp, sc->ip, 0);
a1b62ebe4199926 Darrick J. Wong 2020-10-25 642
a1b62ebe4199926 Darrick J. Wong 2020-10-25 643 /* If we found corruption of any kind, try to fix it. */
a1b62ebe4199926 Darrick J. Wong 2020-10-25 644 if ((sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) ||
a1b62ebe4199926 Darrick J. Wong 2020-10-25 645 (sc->sm->sm_flags & XFS_SCRUB_OFLAG_XCORRUPT)) {
a1b62ebe4199926 Darrick J. Wong 2020-10-25 646 error = xrep_inode_problems(sc);
a1b62ebe4199926 Darrick J. Wong 2020-10-25 647 if (error)
a1b62ebe4199926 Darrick J. Wong 2020-10-25 648 goto out;
a1b62ebe4199926 Darrick J. Wong 2020-10-25 649 }
a1b62ebe4199926 Darrick J. Wong 2020-10-25 650
a1b62ebe4199926 Darrick J. Wong 2020-10-25 651 /* See if we can clear the reflink flag. */
a1b62ebe4199926 Darrick J. Wong 2020-10-25 @652 if (xfs_is_reflink_inode(sc->ip))
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
3 months
[djwong-xfs:reserve-rt-metadata-space 114/173] fs/xfs/scrub/attr_repair.c:111 xrep_setup_xattr_buf() error: we previously assumed 'ab' could be null (see line 100)
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: "Darrick J. Wong" <darrick.wong(a)oracle.com>
TO: "Darrick J. Wong" <darrick.wong(a)oracle.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git reserve-rt-metadata-space
head: a32adbd64a86719b62b97d2b26917850dc374779
commit: 228993683379a044d0a153d31e49168aeb21014a [114/173] xfs: repair extended attributes
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: i386-randconfig-m021-20201130 (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:
fs/xfs/scrub/attr_repair.c:111 xrep_setup_xattr_buf() error: we previously assumed 'ab' could be null (see line 100)
vim +/ab +111 fs/xfs/scrub/attr_repair.c
228993683379a04 Darrick J. Wong 2020-10-25 70
228993683379a04 Darrick J. Wong 2020-10-25 71 /*
228993683379a04 Darrick J. Wong 2020-10-25 72 * Allocate enough memory to hold whatever we need to salvage an attr block.
228993683379a04 Darrick J. Wong 2020-10-25 73 * Buffer contents can be preserved, unlike in the scrub counterpart to this
228993683379a04 Darrick J. Wong 2020-10-25 74 * function.
228993683379a04 Darrick J. Wong 2020-10-25 75 */
228993683379a04 Darrick J. Wong 2020-10-25 76 STATIC int
228993683379a04 Darrick J. Wong 2020-10-25 77 xrep_setup_xattr_buf(
228993683379a04 Darrick J. Wong 2020-10-25 78 struct xfs_scrub *sc,
228993683379a04 Darrick J. Wong 2020-10-25 79 size_t value_size,
228993683379a04 Darrick J. Wong 2020-10-25 80 bool preserve)
228993683379a04 Darrick J. Wong 2020-10-25 81 {
228993683379a04 Darrick J. Wong 2020-10-25 82 size_t sz;
228993683379a04 Darrick J. Wong 2020-10-25 83 struct xchk_xattr_buf *new_ab;
228993683379a04 Darrick J. Wong 2020-10-25 84 struct xchk_xattr_buf *ab = sc->buf;
228993683379a04 Darrick J. Wong 2020-10-25 85
228993683379a04 Darrick J. Wong 2020-10-25 86 ASSERT(!preserve || ab != NULL);
228993683379a04 Darrick J. Wong 2020-10-25 87
228993683379a04 Darrick J. Wong 2020-10-25 88 /*
228993683379a04 Darrick J. Wong 2020-10-25 89 * We need enough space to hold a bitmap for the used space within an
228993683379a04 Darrick J. Wong 2020-10-25 90 * attr block; the name of a salvaged attr; and the value of a salvaged
228993683379a04 Darrick J. Wong 2020-10-25 91 * attr.
228993683379a04 Darrick J. Wong 2020-10-25 92 */
228993683379a04 Darrick J. Wong 2020-10-25 93 sz = sizeof(long) * BITS_TO_LONGS(sc->mp->m_attr_geo->blksize) +
228993683379a04 Darrick J. Wong 2020-10-25 94 value_size + XATTR_NAME_MAX + 1;
228993683379a04 Darrick J. Wong 2020-10-25 95
228993683379a04 Darrick J. Wong 2020-10-25 96 /*
228993683379a04 Darrick J. Wong 2020-10-25 97 * If there's already a buffer, figure out if we need to reallocate it
228993683379a04 Darrick J. Wong 2020-10-25 98 * to accommodate a larger size.
228993683379a04 Darrick J. Wong 2020-10-25 99 */
228993683379a04 Darrick J. Wong 2020-10-25 @100 if (ab && ab->sz >= sz)
228993683379a04 Darrick J. Wong 2020-10-25 101 return 0;
228993683379a04 Darrick J. Wong 2020-10-25 102
228993683379a04 Darrick J. Wong 2020-10-25 103 if (!preserve)
228993683379a04 Darrick J. Wong 2020-10-25 104 kmem_free(ab);
228993683379a04 Darrick J. Wong 2020-10-25 105
228993683379a04 Darrick J. Wong 2020-10-25 106 new_ab = kmem_alloc_large(sizeof(*new_ab) + sz, KM_MAYFAIL);
228993683379a04 Darrick J. Wong 2020-10-25 107 if (!new_ab)
228993683379a04 Darrick J. Wong 2020-10-25 108 return -ENOMEM;
228993683379a04 Darrick J. Wong 2020-10-25 109
228993683379a04 Darrick J. Wong 2020-10-25 110 if (preserve) {
228993683379a04 Darrick J. Wong 2020-10-25 @111 memcpy(new_ab, ab, ab->sz);
228993683379a04 Darrick J. Wong 2020-10-25 112 kmem_free(ab);
228993683379a04 Darrick J. Wong 2020-10-25 113 }
228993683379a04 Darrick J. Wong 2020-10-25 114 new_ab->sz = sz;
228993683379a04 Darrick J. Wong 2020-10-25 115 sc->buf = new_ab;
228993683379a04 Darrick J. Wong 2020-10-25 116 return 0;
228993683379a04 Darrick J. Wong 2020-10-25 117 }
228993683379a04 Darrick J. Wong 2020-10-25 118
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
3 months
[jpirko-mlxsw:petrm_resilient 5/5] net/ipv4/nexthop.c:2638 nexthop_dfs_bucket_activity_write() error: uninitialized symbol 'err'.
by Dan Carpenter
tree: https://github.com/jpirko/linux_mlxsw petrm_resilient
head: f89604f4fb4130335e42ccf65a969ad0a0f58166
commit: f89604f4fb4130335e42ccf65a969ad0a0f58166 [5/5] debugfs for nexthop [xxx]
config: i386-randconfig-m021-20201120 (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:
net/ipv4/nexthop.c:2638 nexthop_dfs_bucket_activity_write() error: uninitialized symbol 'err'.
vim +/err +2638 net/ipv4/nexthop.c
f89604f4fb41303 Petr Machata 2020-11-19 2589 static ssize_t nexthop_dfs_bucket_activity_write(struct file *file,
f89604f4fb41303 Petr Machata 2020-11-19 2590 const char __user *user_buf,
f89604f4fb41303 Petr Machata 2020-11-19 2591 size_t size, loff_t *ppos)
f89604f4fb41303 Petr Machata 2020-11-19 2592 {
f89604f4fb41303 Petr Machata 2020-11-19 2593 const char *tok_bucketid;
f89604f4fb41303 Petr Machata 2020-11-19 2594 const char *tok_nhid;
f89604f4fb41303 Petr Machata 2020-11-19 2595 struct nexthop *nh;
f89604f4fb41303 Petr Machata 2020-11-19 2596 loff_t pos = *ppos;
f89604f4fb41303 Petr Machata 2020-11-19 2597 char buf[128];
f89604f4fb41303 Petr Machata 2020-11-19 2598 u16 bucketid; // xxx or u32 if we choose so
f89604f4fb41303 Petr Machata 2020-11-19 2599 char *ptr;
f89604f4fb41303 Petr Machata 2020-11-19 2600 u32 nhid;
f89604f4fb41303 Petr Machata 2020-11-19 2601 int err;
f89604f4fb41303 Petr Machata 2020-11-19 2602
f89604f4fb41303 Petr Machata 2020-11-19 2603 if (pos < 0)
f89604f4fb41303 Petr Machata 2020-11-19 2604 return -EINVAL;
f89604f4fb41303 Petr Machata 2020-11-19 2605 if (pos == size)
f89604f4fb41303 Petr Machata 2020-11-19 2606 goto skip;
"err" not set on this path.
f89604f4fb41303 Petr Machata 2020-11-19 2607 if (pos)
f89604f4fb41303 Petr Machata 2020-11-19 2608 return -EINVAL;
f89604f4fb41303 Petr Machata 2020-11-19 2609 if (size > sizeof(buf))
f89604f4fb41303 Petr Machata 2020-11-19 2610 return -ENOMEM;
f89604f4fb41303 Petr Machata 2020-11-19 2611 if (copy_from_user(buf, user_buf, size))
f89604f4fb41303 Petr Machata 2020-11-19 2612 return -EFAULT;
f89604f4fb41303 Petr Machata 2020-11-19 2613
f89604f4fb41303 Petr Machata 2020-11-19 2614 buf[sizeof(buf) - 1] = '\0';
f89604f4fb41303 Petr Machata 2020-11-19 2615 ptr = buf;
f89604f4fb41303 Petr Machata 2020-11-19 2616 tok_nhid = strsep(&ptr, " \t");
f89604f4fb41303 Petr Machata 2020-11-19 2617 tok_bucketid = strsep(&ptr, " \t");
f89604f4fb41303 Petr Machata 2020-11-19 2618
f89604f4fb41303 Petr Machata 2020-11-19 2619 if (!tok_nhid || !tok_bucketid || ptr)
f89604f4fb41303 Petr Machata 2020-11-19 2620 return -EINVAL;
f89604f4fb41303 Petr Machata 2020-11-19 2621
f89604f4fb41303 Petr Machata 2020-11-19 2622 err = kstrtou32(tok_nhid, 0, &nhid);
f89604f4fb41303 Petr Machata 2020-11-19 2623 if (err)
f89604f4fb41303 Petr Machata 2020-11-19 2624 return err;
f89604f4fb41303 Petr Machata 2020-11-19 2625
f89604f4fb41303 Petr Machata 2020-11-19 2626 err = kstrtou16(tok_bucketid, 0, &bucketid);
f89604f4fb41303 Petr Machata 2020-11-19 2627 if (err)
f89604f4fb41303 Petr Machata 2020-11-19 2628 return err;
f89604f4fb41303 Petr Machata 2020-11-19 2629
f89604f4fb41303 Petr Machata 2020-11-19 2630 rcu_read_lock();
f89604f4fb41303 Petr Machata 2020-11-19 2631 nh = nexthop_find_by_id(&init_net, nhid);
f89604f4fb41303 Petr Machata 2020-11-19 2632 if (!nh || !nexthop_select_path(nh, bucketid))
f89604f4fb41303 Petr Machata 2020-11-19 2633 err = -ENOENT;
f89604f4fb41303 Petr Machata 2020-11-19 2634 rcu_read_unlock();
f89604f4fb41303 Petr Machata 2020-11-19 2635
f89604f4fb41303 Petr Machata 2020-11-19 2636 skip:
f89604f4fb41303 Petr Machata 2020-11-19 2637 *ppos = size;
f89604f4fb41303 Petr Machata 2020-11-19 @2638 return err ?: size;
^^^
Uninitialized.
f89604f4fb41303 Petr Machata 2020-11-19 2639 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
3 months
[morimoto-linux:fw-cleanup-2020-11-19-v2 64/65] sound/soc/generic/simple-card-utils.c:214 asoc_simple_startup() error: uninitialized symbol 'ret'.
by Dan Carpenter
tree: https://github.com/morimoto/linux fw-cleanup-2020-11-19-v2
head: 162c7cf8b0061392ee4d764c9b714933a739cc6b
commit: e2f5d86c276eb2ea8395c461f7fa3b1369608868 [64/65] ASoC: simple-card-utils: prepare multi DAI - setup1
config: i386-randconfig-m021-20201119 (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:
sound/soc/generic/simple-card-utils.c:214 asoc_simple_startup() error: uninitialized symbol 'ret'.
vim +/ret +214 sound/soc/generic/simple-card-utils.c
f38df5bf0c9cb90 Kuninori Morimoto 2019-03-20 194 int asoc_simple_startup(struct snd_pcm_substream *substream)
f38df5bf0c9cb90 Kuninori Morimoto 2019-03-20 195 {
9ae035e289379ba Kuninori Morimoto 2020-07-20 196 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
f38df5bf0c9cb90 Kuninori Morimoto 2019-03-20 197 struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 198 struct simple_dai_props *props = simple_priv_to_props(priv, rtd->num);
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 199 struct asoc_simple_dai *dai;
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 200 int i1, i2, i;
f38df5bf0c9cb90 Kuninori Morimoto 2019-03-20 201 int ret;
f38df5bf0c9cb90 Kuninori Morimoto 2019-03-20 202
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 203 for_each_prop_dai_cpu(props, i1, dai) {
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 204 ret = asoc_simple_clk_enable(dai);
f38df5bf0c9cb90 Kuninori Morimoto 2019-03-20 205 if (ret)
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 206 goto cpu_err;
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 207 }
f38df5bf0c9cb90 Kuninori Morimoto 2019-03-20 208
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 209 for_each_prop_dai_codec(props, i2, dai) {
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 210 ret = asoc_simple_clk_enable(dai);
f38df5bf0c9cb90 Kuninori Morimoto 2019-03-20 211 if (ret)
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 212 goto codec_err;
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 213 }
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 @214 return ret;
It's probably unlikely that we wouldn't enter both loops, but it would
be nicer to just "return 0;"
f38df5bf0c9cb90 Kuninori Morimoto 2019-03-20 215
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 216 codec_err:
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 217 for_each_prop_dai_codec(props, i, dai) {
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 218 if (i >= i2)
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 219 break;
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 220 asoc_simple_clk_disable(dai);
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 221 }
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 222 cpu_err:
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 223 for_each_prop_dai_cpu(props, i, dai) {
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 224 if (i >= i1)
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 225 break;
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 226 asoc_simple_clk_disable(dai);
e2f5d86c276eb2e Kuninori Morimoto 2020-11-19 227 }
f38df5bf0c9cb90 Kuninori Morimoto 2019-03-20 228 return ret;
f38df5bf0c9cb90 Kuninori Morimoto 2019-03-20 229 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
3 months
[linux-next:master 8942/9613] fs/btrfs/zoned.c:71 btrfs_get_dev_zone_info() warn: should 'zone_sectors << 9' be a 64 bit
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm(a)kvack.org>
TO: Naohiro Aota <naohiro.aota(a)wdc.com>
CC: David Sterba <dsterba(a)suse.com>
CC: Josef Bacik <josef(a)toxicpanda.com>
CC: Damien Le Moal <damien.lemoal(a)wdc.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: c6b11acc5f85b6e11d128fad8e0b7b223aa7e33f
commit: fc34d0e8a6e72c41baf9798ecf68cd90d8798347 [8942/9613] btrfs: get zone information of zoned block devices
:::::: branch date: 4 hours ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-m001-20201130 (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:
fs/btrfs/zoned.c:71 btrfs_get_dev_zone_info() warn: should 'zone_sectors << 9' be a 64 bit type?
vim +71 fs/btrfs/zoned.c
fc34d0e8a6e72c Naohiro Aota 2020-11-10 45
fc34d0e8a6e72c Naohiro Aota 2020-11-10 46 int btrfs_get_dev_zone_info(struct btrfs_device *device)
fc34d0e8a6e72c Naohiro Aota 2020-11-10 47 {
fc34d0e8a6e72c Naohiro Aota 2020-11-10 48 struct btrfs_zoned_device_info *zone_info = NULL;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 49 struct block_device *bdev = device->bdev;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 50 sector_t nr_sectors;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 51 sector_t sector = 0;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 52 struct blk_zone *zones = NULL;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 53 unsigned int i, nreported = 0, nr_zones;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 54 unsigned int zone_sectors;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 55 int ret;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 56
fc34d0e8a6e72c Naohiro Aota 2020-11-10 57 if (!bdev_is_zoned(bdev))
fc34d0e8a6e72c Naohiro Aota 2020-11-10 58 return 0;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 59
fc34d0e8a6e72c Naohiro Aota 2020-11-10 60 if (device->zone_info)
fc34d0e8a6e72c Naohiro Aota 2020-11-10 61 return 0;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 62
fc34d0e8a6e72c Naohiro Aota 2020-11-10 63 zone_info = kzalloc(sizeof(*zone_info), GFP_KERNEL);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 64 if (!zone_info)
fc34d0e8a6e72c Naohiro Aota 2020-11-10 65 return -ENOMEM;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 66
fc34d0e8a6e72c Naohiro Aota 2020-11-10 67 nr_sectors = bdev->bd_part->nr_sects;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 68 zone_sectors = bdev_zone_sectors(bdev);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 69 /* Check if it's power of 2 (see is_power_of_2) */
fc34d0e8a6e72c Naohiro Aota 2020-11-10 70 ASSERT(zone_sectors != 0 && (zone_sectors & (zone_sectors - 1)) == 0);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 @71 zone_info->zone_size = zone_sectors << SECTOR_SHIFT;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 72 zone_info->zone_size_shift = ilog2(zone_info->zone_size);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 73 zone_info->nr_zones = nr_sectors >> ilog2(zone_sectors);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 74 if (!IS_ALIGNED(nr_sectors, zone_sectors))
fc34d0e8a6e72c Naohiro Aota 2020-11-10 75 zone_info->nr_zones++;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 76
fc34d0e8a6e72c Naohiro Aota 2020-11-10 77 zone_info->seq_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 78 if (!zone_info->seq_zones) {
fc34d0e8a6e72c Naohiro Aota 2020-11-10 79 ret = -ENOMEM;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 80 goto out;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 81 }
fc34d0e8a6e72c Naohiro Aota 2020-11-10 82
fc34d0e8a6e72c Naohiro Aota 2020-11-10 83 zone_info->empty_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 84 if (!zone_info->empty_zones) {
fc34d0e8a6e72c Naohiro Aota 2020-11-10 85 ret = -ENOMEM;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 86 goto out;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 87 }
fc34d0e8a6e72c Naohiro Aota 2020-11-10 88
fc34d0e8a6e72c Naohiro Aota 2020-11-10 89 zones = kcalloc(BTRFS_REPORT_NR_ZONES, sizeof(struct blk_zone), GFP_KERNEL);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 90 if (!zones) {
fc34d0e8a6e72c Naohiro Aota 2020-11-10 91 ret = -ENOMEM;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 92 goto out;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 93 }
fc34d0e8a6e72c Naohiro Aota 2020-11-10 94
fc34d0e8a6e72c Naohiro Aota 2020-11-10 95 /* Get zones type */
fc34d0e8a6e72c Naohiro Aota 2020-11-10 96 while (sector < nr_sectors) {
fc34d0e8a6e72c Naohiro Aota 2020-11-10 97 nr_zones = BTRFS_REPORT_NR_ZONES;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 98 ret = btrfs_get_dev_zones(device, sector << SECTOR_SHIFT, zones,
fc34d0e8a6e72c Naohiro Aota 2020-11-10 99 &nr_zones);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 100 if (ret)
fc34d0e8a6e72c Naohiro Aota 2020-11-10 101 goto out;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 102
fc34d0e8a6e72c Naohiro Aota 2020-11-10 103 for (i = 0; i < nr_zones; i++) {
fc34d0e8a6e72c Naohiro Aota 2020-11-10 104 if (zones[i].type == BLK_ZONE_TYPE_SEQWRITE_REQ)
fc34d0e8a6e72c Naohiro Aota 2020-11-10 105 __set_bit(nreported, zone_info->seq_zones);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 106 if (zones[i].cond == BLK_ZONE_COND_EMPTY)
fc34d0e8a6e72c Naohiro Aota 2020-11-10 107 __set_bit(nreported, zone_info->empty_zones);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 108 nreported++;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 109 }
fc34d0e8a6e72c Naohiro Aota 2020-11-10 110 sector = zones[nr_zones - 1].start + zones[nr_zones - 1].len;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 111 }
fc34d0e8a6e72c Naohiro Aota 2020-11-10 112
fc34d0e8a6e72c Naohiro Aota 2020-11-10 113 if (nreported != zone_info->nr_zones) {
fc34d0e8a6e72c Naohiro Aota 2020-11-10 114 btrfs_err_in_rcu(device->fs_info,
fc34d0e8a6e72c Naohiro Aota 2020-11-10 115 "inconsistent number of zones on %s (%u/%u)",
fc34d0e8a6e72c Naohiro Aota 2020-11-10 116 rcu_str_deref(device->name), nreported,
fc34d0e8a6e72c Naohiro Aota 2020-11-10 117 zone_info->nr_zones);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 118 ret = -EIO;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 119 goto out;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 120 }
fc34d0e8a6e72c Naohiro Aota 2020-11-10 121
fc34d0e8a6e72c Naohiro Aota 2020-11-10 122 kfree(zones);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 123
fc34d0e8a6e72c Naohiro Aota 2020-11-10 124 device->zone_info = zone_info;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 125
fc34d0e8a6e72c Naohiro Aota 2020-11-10 126 /* device->fs_info is not safe to use for printing messages */
fc34d0e8a6e72c Naohiro Aota 2020-11-10 127 btrfs_info_in_rcu(NULL,
fc34d0e8a6e72c Naohiro Aota 2020-11-10 128 "host-%s zoned block device %s, %u zones of %llu bytes",
fc34d0e8a6e72c Naohiro Aota 2020-11-10 129 bdev_zoned_model(bdev) == BLK_ZONED_HM ? "managed" : "aware",
fc34d0e8a6e72c Naohiro Aota 2020-11-10 130 rcu_str_deref(device->name), zone_info->nr_zones,
fc34d0e8a6e72c Naohiro Aota 2020-11-10 131 zone_info->zone_size);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 132
fc34d0e8a6e72c Naohiro Aota 2020-11-10 133 return 0;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 134
fc34d0e8a6e72c Naohiro Aota 2020-11-10 135 out:
fc34d0e8a6e72c Naohiro Aota 2020-11-10 136 kfree(zones);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 137 bitmap_free(zone_info->empty_zones);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 138 bitmap_free(zone_info->seq_zones);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 139 kfree(zone_info);
fc34d0e8a6e72c Naohiro Aota 2020-11-10 140
fc34d0e8a6e72c Naohiro Aota 2020-11-10 141 return ret;
fc34d0e8a6e72c Naohiro Aota 2020-11-10 142 }
fc34d0e8a6e72c Naohiro Aota 2020-11-10 143
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
3 months