]> www.infradead.org Git - users/hch/block.git/commitdiff
coredump: use bvec_set_page to initialize a bvec
authorChristoph Hellwig <hch@lst.de>
Wed, 25 Jan 2023 16:32:55 +0000 (17:32 +0100)
committerChristoph Hellwig <hch@lst.de>
Wed, 25 Jan 2023 17:29:34 +0000 (18:29 +0100)
Use the bvec_set_page helper to initialize a bvec.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/coredump.c

index de78bde2991beb8286bce57899122f559c41ce21..0a6873a9c4d0cdf01b2163f3c09286e5b1d22aaa 100644 (file)
@@ -840,11 +840,7 @@ static int __dump_skip(struct coredump_params *cprm, size_t nr)
 
 static int dump_emit_page(struct coredump_params *cprm, struct page *page)
 {
-       struct bio_vec bvec = {
-               .bv_page        = page,
-               .bv_offset      = 0,
-               .bv_len         = PAGE_SIZE,
-       };
+       struct bio_vec bvec;
        struct iov_iter iter;
        struct file *file = cprm->file;
        loff_t pos;
@@ -860,6 +856,7 @@ static int dump_emit_page(struct coredump_params *cprm, struct page *page)
        if (dump_interrupted())
                return 0;
        pos = file->f_pos;
+       bvec_set_page(&bvec, page, PAGE_SIZE, 0);
        iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE);
        n = __kernel_write_iter(cprm->file, &iter, &pos);
        if (n != PAGE_SIZE)