]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
pktcdvd: don't scribble over the bvec array
authorChristoph Hellwig <hch@lst.de>
Thu, 27 Oct 2016 07:04:44 +0000 (09:04 +0200)
committerJens Axboe <axboe@fb.com>
Mon, 7 Nov 2016 15:50:54 +0000 (08:50 -0700)
commitfeebd5687257750bb75eaf5188b93756994b8c41
treeddfd009957bde3b57a0c7a570fc358f54d89bb51
parentc02ebfdddbafa9a6a0f52fbd715e6bfa229af9d3
pktcdvd: don't scribble over the bvec array

Hi Peter, hi Jens,

I've been looking over the multi page bio vec work again recently, and
one of the stumbling blocks is raw biovec access in the pktcdvd.

The first issue is that it directly sets up the page and offset pointers
in the biovec just before calling bio_add_page.  As bio_add_page already
does the setup it's trivial to just switch it to stack variables for the
arguments.

The second issue is the copy code in pkt_make_local_copy, which
effectively is an opencoded version of bio_copy_data except that it
skips pages that already are the same in the Ń•ource and destination.
But we look at the only calleer we just set up the bio using bio_add_page
to point exactly to the page array that pkt_make_local_copy compares,
so the pages will always be the same and we can just remove this function.

Note that all this is done based on code inspection, I don't have any
packet writing hardware myself.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/pktcdvd.c