drivers/gpu/drm/i915/i915_mm.c:76 remap_io_sg() error: uninitialized symbol 'err'.
Subsystems (3)
PATCH 8015/8469 drivers/gpu/drm/i915/i915_mm.c:76 remap_io_sg() error: uninitialized symbol 'err'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 9d49ed9ca93b8c564033c1d6808017bc9052b5db commit: 204302d90503407d2af233c1222b2e79f35580f3 [8015/8469] i915: fix remap_io_sg to verify the pgprot config: i386-randconfig-m021-20210329 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
smatch warnings:drivers/gpu/drm/i915/i915_mm.c:76 remap_io_sg() error: uninitialized symbol 'err'.
vim +/err +76 drivers/gpu/drm/i915/i915_mm.c
4e598fad226be0 Abdiel Janulgue 2020-01-03 45 int remap_io_sg(struct vm_area_struct *vma,
1764b992be0f1c Abdiel Janulgue 2019-12-31 46 unsigned long addr, unsigned long size,
4e598fad226be0 Abdiel Janulgue 2020-01-03 47 struct scatterlist *sgl, resource_size_t iobase)
1764b992be0f1c Abdiel Janulgue 2019-12-31 48 {
204302d9050340 Christoph Hellwig 2021-03-29 49 unsigned long pfn, len, remapped = 0;
1764b992be0f1c Abdiel Janulgue 2019-12-31 50 int err;
1764b992be0f1c Abdiel Janulgue 2019-12-31 51
1764b992be0f1c Abdiel Janulgue 2019-12-31 52 /* We rely on prevalidation of the io-mapping to skip track_pfn(). */
1764b992be0f1c Abdiel Janulgue 2019-12-31 53 GEM_BUG_ON((vma->vm_flags & EXPECTED_FLAGS) != EXPECTED_FLAGS);
1764b992be0f1c Abdiel Janulgue 2019-12-31 54
4e598fad226be0 Abdiel Janulgue 2020-01-03 55 if (!use_dma(iobase))
1764b992be0f1c Abdiel Janulgue 2019-12-31 56 flush_cache_range(vma, addr, size);
4e598fad226be0 Abdiel Janulgue 2020-01-03 57
204302d9050340 Christoph Hellwig 2021-03-29 58 do {
204302d9050340 Christoph Hellwig 2021-03-29 59 if (use_dma(iobase)) {
204302d9050340 Christoph Hellwig 2021-03-29 60 if (!sg_dma_len(sgl))
204302d9050340 Christoph Hellwig 2021-03-29 61 break;
^^^^^Can this break on the first iteration through the loop?
204302d9050340 Christoph Hellwig 2021-03-29 62 pfn = (sg_dma_address(sgl) + iobase) >> PAGE_SHIFT;
204302d9050340 Christoph Hellwig 2021-03-29 63 len = sg_dma_len(sgl);
204302d9050340 Christoph Hellwig 2021-03-29 64 } else {
204302d9050340 Christoph Hellwig 2021-03-29 65 pfn = page_to_pfn(sg_page(sgl));
204302d9050340 Christoph Hellwig 2021-03-29 66 len = sgl->length;
1764b992be0f1c Abdiel Janulgue 2019-12-31 67 }
1764b992be0f1c Abdiel Janulgue 2019-12-31 68
204302d9050340 Christoph Hellwig 2021-03-29 69 err = remap_pfn_range(vma, addr + remapped, pfn, len,
204302d9050340 Christoph Hellwig 2021-03-29 70 vma->vm_page_prot);
204302d9050340 Christoph Hellwig 2021-03-29 71 if (err)
204302d9050340 Christoph Hellwig 2021-03-29 72 break;
204302d9050340 Christoph Hellwig 2021-03-29 73 remapped += len;
204302d9050340 Christoph Hellwig 2021-03-29 74 } while ((sgl = __sg_next(sgl)));
204302d9050340 Christoph Hellwig 2021-03-29 75 204302d9050340 Christoph Hellwig 2021-03-29 @76 if (err)
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Quoted 1 line · Dan Carpenter
drivers/gpu/drm/i915/i915_mm.c:76remap_io_sg()error: uninitialized symbol 'err'.
Having an SGL where the first entry has a 0 dma_length is not valid. That being said, the trivial patch below will remove the warning and is otherwise harmless, so we could fold it in:
drivers/gpu/drm/i915/i915_mm.c +1 -1
@@ -47,7 +47,7 @@ int remap_io_sg(struct vm_area_struct *vma, struct scatterlist *sgl, resource_size_t iobase) {unsigned long pfn, len, remapped =0 ; -int err; +int err =0 ;/* We rely on prevalidation of the io-mapping to skip track_pfn(). */ GEM_BUG_ON ((vma->vm_flags &EXPECTED_FLAGS ) !=EXPECTED_FLAGS );