drivers/nvme/target/io-cmd-bdev.c:275:25: sparse: sparse: restricted __le16 degrades to integer
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: dab2734f8e9ecba609d66d1dd087a392a7774c04 commit: 3ec5c62cfcf060e9ea533cd3901f5d03b26ddc24 [5900/8513] nvmet: handle rw's limited retry flag config: openrisc-randconfig-r111-20250114 (https://download.01.org/0day-ci/archive/20250114/[email protected]/config) compiler: or1k-linux-gcc (GCC) 14.2.0 reproduce: (https://download.01.org/0day-ci/archive/20250114/[email protected]/reproduce)
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
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/nvme/target/io-cmd-bdev.c:275:25: sparse: sparse: restricted __le16 degrades to integer
vim +275 drivers/nvme/target/io-cmd-bdev.c
243
244 static void nvmet_bdev_execute_rw(struct nvmet_req *req)
245 {
246 unsigned int sg_cnt = req->sg_cnt;
247 struct bio *bio;
248 struct scatterlist *sg;
249 struct blk_plug plug;
250 sector_t sector;
251 blk_opf_t opf;
252 int i, rc;
253 struct sg_mapping_iter prot_miter;
254 unsigned int iter_flags;
255 unsigned int total_len = nvmet_rw_data_len(req) + req->metadata_len;
256
257 if (!nvmet_check_transfer_len(req, total_len))
258 return;
259
260 if (!req->sg_cnt) {
261 nvmet_req_complete(req, 0);
262 return;
263 }
264
265 if (req->cmd->rw.opcode == nvme_cmd_write) {
266 opf = REQ_OP_WRITE | REQ_SYNC | REQ_IDLE;
267 if (req->cmd->rw.control & cpu_to_le16(NVME_RW_FUA))
268 opf |= REQ_FUA;
269 iter_flags = SG_MITER_TO_SG;
270 } else {
271 opf = REQ_OP_READ;
272 iter_flags = SG_MITER_FROM_SG;
273 }
274
> 275 if (req->cmd->rw.control & NVME_RW_LR)
276 opf |= REQ_FAILFAST_DEV;
277
278 if (is_pci_p2pdma_page(sg_page(req->sg)))
279 opf |= REQ_NOMERGE;
280
281 sector = nvmet_lba_to_sect(req->ns, req->cmd->rw.slba);
282
283 if (nvmet_use_inline_bvec(req)) {
284 bio = &req->b.inline_bio;
285 bio_init(bio, req->ns->bdev, req->inline_bvec,
286 ARRAY_SIZE(req->inline_bvec), opf);
287 } else {
288 bio = bio_alloc(req->ns->bdev, bio_max_segs(sg_cnt), opf,
289 GFP_KERNEL);
290 }
291 bio->bi_iter.bi_sector = sector;
292 bio->bi_private = req;
293 bio->bi_end_io = nvmet_bio_done;
294
295 blk_start_plug(&plug);
296 if (req->metadata_len)
297 sg_miter_start(&prot_miter, req->metadata_sg,
298 req->metadata_sg_cnt, iter_flags);
299
300 for_each_sg(req->sg, sg, req->sg_cnt, i) {
301 while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
302 != sg->length) {
303 struct bio *prev = bio;
304
305 if (req->metadata_len) {
306 rc = nvmet_bdev_alloc_bip(req, bio,
307 &prot_miter);
308 if (unlikely(rc)) {
309 bio_io_error(bio);
310 return;
311 }
312 }
313
314 bio = bio_alloc(req->ns->bdev, bio_max_segs(sg_cnt),
315 opf, GFP_KERNEL);
316 bio->bi_iter.bi_sector = sector;
317
318 bio_chain(bio, prev);
319 submit_bio(prev);
320 }
321
322 sector += sg->length >> 9;
323 sg_cnt--;
324 }
325
326 if (req->metadata_len) {
327 rc = nvmet_bdev_alloc_bip(req, bio, &prot_miter);
328 if (unlikely(rc)) {
329 bio_io_error(bio);
330 return;
331 }
332 }
333
334 submit_bio(bio);
335 blk_finish_plug(&plug);
336 }
337
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki