Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vringh: use bvec_kmap_local

Use the bvec_kmap_local helper rather than digging into the bvec
internals.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Message-Id: <20250501142244.2888227-1-hch@lst.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

authored by

Christoph Hellwig and committed by
Michael S. Tsirkin
169294a1 8b3f9967

+6 -8
+6 -8
drivers/vhost/vringh.c
··· 1290 1290 if (ret) 1291 1291 return ret; 1292 1292 } else { 1293 - void *kaddr = kmap_local_page(ivec.iov.bvec[0].bv_page); 1294 - void *from = kaddr + ivec.iov.bvec[0].bv_offset; 1293 + __virtio16 *from = bvec_kmap_local(&ivec.iov.bvec[0]); 1295 1294 1296 - tmp = READ_ONCE(*(__virtio16 *)from); 1297 - kunmap_local(kaddr); 1295 + tmp = READ_ONCE(*from); 1296 + kunmap_local(from); 1298 1297 } 1299 1298 1300 1299 *val = vringh16_to_cpu(vrh, tmp); ··· 1328 1329 if (ret) 1329 1330 return ret; 1330 1331 } else { 1331 - void *kaddr = kmap_local_page(ivec.iov.bvec[0].bv_page); 1332 - void *to = kaddr + ivec.iov.bvec[0].bv_offset; 1332 + __virtio16 *to = bvec_kmap_local(&ivec.iov.bvec[0]); 1333 1333 1334 - WRITE_ONCE(*(__virtio16 *)to, tmp); 1335 - kunmap_local(kaddr); 1334 + WRITE_ONCE(*to, tmp); 1335 + kunmap_local(to); 1336 1336 } 1337 1337 1338 1338 return 0;