diff options
Diffstat (limited to 'drivers/char/virtio_console.c')
-rw-r--r-- | drivers/char/virtio_console.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index feea87cc6b8f..6928d094451d 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -890,12 +890,10 @@ static int pipe_to_sg(struct pipe_inode_info *pipe, struct pipe_buffer *buf, | |||
890 | } else { | 890 | } else { |
891 | /* Failback to copying a page */ | 891 | /* Failback to copying a page */ |
892 | struct page *page = alloc_page(GFP_KERNEL); | 892 | struct page *page = alloc_page(GFP_KERNEL); |
893 | char *src = buf->ops->map(pipe, buf, 1); | 893 | char *src; |
894 | char *dst; | ||
895 | 894 | ||
896 | if (!page) | 895 | if (!page) |
897 | return -ENOMEM; | 896 | return -ENOMEM; |
898 | dst = kmap(page); | ||
899 | 897 | ||
900 | offset = sd->pos & ~PAGE_MASK; | 898 | offset = sd->pos & ~PAGE_MASK; |
901 | 899 | ||
@@ -903,9 +901,8 @@ static int pipe_to_sg(struct pipe_inode_info *pipe, struct pipe_buffer *buf, | |||
903 | if (len + offset > PAGE_SIZE) | 901 | if (len + offset > PAGE_SIZE) |
904 | len = PAGE_SIZE - offset; | 902 | len = PAGE_SIZE - offset; |
905 | 903 | ||
906 | memcpy(dst + offset, src + buf->offset, len); | 904 | src = buf->ops->map(pipe, buf, 1); |
907 | 905 | memcpy(page_address(page) + offset, src + buf->offset, len); | |
908 | kunmap(page); | ||
909 | buf->ops->unmap(pipe, buf, src); | 906 | buf->ops->unmap(pipe, buf, src); |
910 | 907 | ||
911 | sg_set_page(&(sgl->sg[sgl->n]), page, len, offset); | 908 | sg_set_page(&(sgl->sg[sgl->n]), page, len, offset); |