]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rnbd-srv: use bio_add_virt_nofail
authorChristoph Hellwig <hch@lst.de>
Wed, 7 May 2025 12:04:33 +0000 (14:04 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 7 May 2025 13:31:07 +0000 (07:31 -0600)
Use the bio_add_virt_nofail to add a single kernel virtual address
to a bio as that can't fail.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20250507120451.4000627-10-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/rnbd/rnbd-srv.c

index 2ee6e9bd4e28645e71b289c938fe918701755c22..2df8941a6b1463ab42f5083697dd3a3fa9dff1da 100644 (file)
@@ -147,12 +147,7 @@ static int process_rdma(struct rnbd_srv_session *srv_sess,
 
        bio = bio_alloc(file_bdev(sess_dev->bdev_file), 1,
                        rnbd_to_bio_flags(le32_to_cpu(msg->rw)), GFP_KERNEL);
-       if (bio_add_page(bio, virt_to_page(data), datalen,
-                       offset_in_page(data)) != datalen) {
-               rnbd_srv_err_rl(sess_dev, "Failed to map data to bio\n");
-               err = -EINVAL;
-               goto bio_put;
-       }
+       bio_add_virt_nofail(bio, data, datalen);
 
        bio->bi_opf = rnbd_to_bio_flags(le32_to_cpu(msg->rw));
        if (bio_has_data(bio) &&