From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: drivers/xen/grant-dma-ops.c:174 xen_grant_dma_map_phys() warn: mask and shift to zero: expr='offset >> 12'
Date: Fri, 05 Jun 2026 09:23:41 +0800 [thread overview]
Message-ID: <202606050924.np68TBk4-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Leon Romanovsky <leonro@nvidia.com>
CC: Marek Szyprowski <m.szyprowski@samsung.com>
CC: Jason Gunthorpe <jgg@nvidia.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ddd664bbff63e09e7a7f9acae9c43605d4cf185f
commit: 936a9f0cb16b0646143f8e05afab458adc51d0a0 xen: swiotlb: Convert mapping routine to rely on physical address
date: 7 months ago
:::::: branch date: 4 hours ago
:::::: commit date: 7 months ago
config: x86_64-randconfig-161-20260605 (https://download.01.org/0day-ci/archive/20260605/202606050924.np68TBk4-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9185-gbcc58b9c
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 936a9f0cb16b ("xen: swiotlb: Convert mapping routine to rely on physical address")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202606050924.np68TBk4-lkp@intel.com/
smatch warnings:
drivers/xen/grant-dma-ops.c:174 xen_grant_dma_map_phys() warn: mask and shift to zero: expr='offset >> 12'
vim +174 drivers/xen/grant-dma-ops.c
d6aca3504c7ded Juergen Gross 2022-06-02 165
936a9f0cb16b06 Leon Romanovsky 2025-10-15 166 static dma_addr_t xen_grant_dma_map_phys(struct device *dev, phys_addr_t phys,
936a9f0cb16b06 Leon Romanovsky 2025-10-15 167 size_t size,
d6aca3504c7ded Juergen Gross 2022-06-02 168 enum dma_data_direction dir,
d6aca3504c7ded Juergen Gross 2022-06-02 169 unsigned long attrs)
d6aca3504c7ded Juergen Gross 2022-06-02 170 {
d6aca3504c7ded Juergen Gross 2022-06-02 171 struct xen_grant_dma_data *data;
936a9f0cb16b06 Leon Romanovsky 2025-10-15 172 unsigned long offset = offset_in_page(phys);
a383dcb1cca830 Oleksandr Tyshchenko 2022-10-08 173 unsigned long dma_offset = xen_offset_in_page(offset),
a383dcb1cca830 Oleksandr Tyshchenko 2022-10-08 @174 pfn_offset = XEN_PFN_DOWN(offset);
a383dcb1cca830 Oleksandr Tyshchenko 2022-10-08 175 unsigned int i, n_pages = XEN_PFN_UP(dma_offset + size);
d6aca3504c7ded Juergen Gross 2022-06-02 176 grant_ref_t grant;
d6aca3504c7ded Juergen Gross 2022-06-02 177 dma_addr_t dma_handle;
d6aca3504c7ded Juergen Gross 2022-06-02 178
936a9f0cb16b06 Leon Romanovsky 2025-10-15 179 if (unlikely(attrs & DMA_ATTR_MMIO))
936a9f0cb16b06 Leon Romanovsky 2025-10-15 180 return DMA_MAPPING_ERROR;
936a9f0cb16b06 Leon Romanovsky 2025-10-15 181
d6aca3504c7ded Juergen Gross 2022-06-02 182 if (WARN_ON(dir == DMA_NONE))
d6aca3504c7ded Juergen Gross 2022-06-02 183 return DMA_MAPPING_ERROR;
d6aca3504c7ded Juergen Gross 2022-06-02 184
d6aca3504c7ded Juergen Gross 2022-06-02 185 data = find_xen_grant_dma_data(dev);
d6aca3504c7ded Juergen Gross 2022-06-02 186 if (!data)
d6aca3504c7ded Juergen Gross 2022-06-02 187 return DMA_MAPPING_ERROR;
d6aca3504c7ded Juergen Gross 2022-06-02 188
d6aca3504c7ded Juergen Gross 2022-06-02 189 if (unlikely(data->broken))
d6aca3504c7ded Juergen Gross 2022-06-02 190 return DMA_MAPPING_ERROR;
d6aca3504c7ded Juergen Gross 2022-06-02 191
d6aca3504c7ded Juergen Gross 2022-06-02 192 if (gnttab_alloc_grant_reference_seq(n_pages, &grant))
d6aca3504c7ded Juergen Gross 2022-06-02 193 return DMA_MAPPING_ERROR;
d6aca3504c7ded Juergen Gross 2022-06-02 194
d6aca3504c7ded Juergen Gross 2022-06-02 195 for (i = 0; i < n_pages; i++) {
d6aca3504c7ded Juergen Gross 2022-06-02 196 gnttab_grant_foreign_access_ref(grant + i, data->backend_domid,
936a9f0cb16b06 Leon Romanovsky 2025-10-15 197 pfn_to_gfn(page_to_xen_pfn(phys_to_page(phys)) + i + pfn_offset),
875553e317b28e Oleksandr Tyshchenko 2022-10-08 198 dir == DMA_TO_DEVICE);
d6aca3504c7ded Juergen Gross 2022-06-02 199 }
d6aca3504c7ded Juergen Gross 2022-06-02 200
875553e317b28e Oleksandr Tyshchenko 2022-10-08 201 dma_handle = grant_to_dma(grant) + dma_offset;
d6aca3504c7ded Juergen Gross 2022-06-02 202
d6aca3504c7ded Juergen Gross 2022-06-02 203 return dma_handle;
d6aca3504c7ded Juergen Gross 2022-06-02 204 }
d6aca3504c7ded Juergen Gross 2022-06-02 205
:::::: The code at line 174 was first introduced by commit
:::::: a383dcb1cca8305497877119fba0a320f41fe853 xen/virtio: Convert PAGE_SIZE/PAGE_SHIFT/PFN_UP to Xen counterparts
:::::: TO: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
:::::: CC: Juergen Gross <jgross@suse.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2026-06-05 1:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 1:23 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-09-23 19:11 drivers/xen/grant-dma-ops.c:174 xen_grant_dma_map_phys() warn: mask and shift to zero: expr='offset >> 12' kernel test robot
2026-02-16 22:02 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202606050924.np68TBk4-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.