This can't happen right now, but in preparation for allowing bio_split_to_limits() returning NULL if it ended the bio, check for it in all the callers.
···358358 default:359359 split = bio_split_rw(bio, lim, nr_segs, bs,360360 get_max_io_size(bio, lim) << SECTOR_SHIFT);361361+ if (IS_ERR(split))362362+ return NULL;361363 break;362364 }363365364366 if (split) {365365- /* there isn't chance to merge the splitted bio */367367+ /* there isn't chance to merge the split bio */366368 split->bi_opf |= REQ_NOMERGE;367369368370 blkcg_bio_issue_init(split);
+4-1
block/blk-mq.c
···29512951 blk_status_t ret;2952295229532953 bio = blk_queue_bounce(bio, q);29542954- if (bio_may_exceed_limits(bio, &q->limits))29542954+ if (bio_may_exceed_limits(bio, &q->limits)) {29552955 bio = __bio_split_to_limits(bio, &q->limits, &nr_segs);29562956+ if (!bio)29572957+ return;29582958+ }2956295929572960 if (!bio_integrity_prep(bio))29582961 return;
···587587 dev_dbg(&dev->core, "%s\n", __func__);588588589589 bio = bio_split_to_limits(bio);590590+ if (!bio)591591+ return;590592591593 spin_lock_irq(&priv->lock);592594 busy = !bio_list_empty(&priv->list);
+2
drivers/md/dm.c
···17421742 * otherwise associated queue_limits won't be imposed.17431743 */17441744 bio = bio_split_to_limits(bio);17451745+ if (!bio)17461746+ return;17451747 }1746174817471749 init_clone_info(&ci, md, map, bio, is_abnormal);
+2
drivers/md/md.c
···455455 }456456457457 bio = bio_split_to_limits(bio);458458+ if (!bio)459459+ return;458460459461 if (mddev->ro == MD_RDONLY && unlikely(rw == WRITE)) {460462 if (bio_sectors(bio) != 0)
+2
drivers/nvme/host/multipath.c
···376376 * pool from the original queue to allocate the bvecs from.377377 */378378 bio = bio_split_to_limits(bio);379379+ if (!bio)380380+ return;379381380382 srcu_idx = srcu_read_lock(&head->srcu);381383 ns = nvme_find_path(head);
+2
drivers/s390/block/dcssblk.c
···865865 unsigned long bytes_done;866866867867 bio = bio_split_to_limits(bio);868868+ if (!bio)869869+ return;868870869871 bytes_done = 0;870872 dev_info = bio->bi_bdev->bd_disk->private_data;