{"id":816239,"url":"http://patchwork.ozlabs.org/api/patches/816239/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170920114310.13080-2-el13635@mail.ntua.gr/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170920114310.13080-2-el13635@mail.ntua.gr>","list_archive_url":null,"date":"2017-09-20T11:43:09","name":"[1/2] block/block-backend.c: add blk_check_byte_request call to blk_pread/blk_pwrite","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"fc069ad370ea36012dd924d22636e44c0799c50b","submitter":{"id":71571,"url":"http://patchwork.ozlabs.org/api/people/71571/?format=json","name":"Manos Pitsidianakis","email":"el13635@mail.ntua.gr"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170920114310.13080-2-el13635@mail.ntua.gr/mbox/","series":[{"id":4125,"url":"http://patchwork.ozlabs.org/api/series/4125/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=4125","date":"2017-09-20T11:43:09","name":"remove blk_pread_unthrottled()","version":1,"mbox":"http://patchwork.ozlabs.org/series/4125/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816239/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816239/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xy1g02HNYz9s82\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 00:03:24 +1000 (AEST)","from localhost ([::1]:48284 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dufb0-0008TL-9c\n\tfor incoming@patchwork.ozlabs.org; Wed, 20 Sep 2017 10:03:22 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:41757)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <el13635@mail.ntua.gr>) id 1dufAW-00024b-Qe\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 09:36:01 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <el13635@mail.ntua.gr>) id 1dufAS-00011k-Sx\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 09:36:00 -0400","from smtp1.ntua.gr ([2001:648:2000:de::183]:20570)\n\tby eggs.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <el13635@mail.ntua.gr>)\n\tid 1dufAK-0000sM-51; Wed, 20 Sep 2017 09:35:48 -0400","from mail.ntua.gr (carp0.noc.ntua.gr [147.102.222.60])\n\t(authenticated bits=0)\n\tby smtp1.ntua.gr (8.15.2/8.15.2) with ESMTPSA id v8KBhZCv074332\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=NOT); Wed, 20 Sep 2017 14:43:35 +0300 (EEST)\n\t(envelope-from el13635@mail.ntua.gr)"],"X-Authentication-Warning":"smtp1.ntua.gr: Host carp0.noc.ntua.gr\n\t[147.102.222.60] claimed to be mail.ntua.gr","From":"Manos Pitsidianakis <el13635@mail.ntua.gr>","To":"qemu-devel <qemu-devel@nongnu.org>","Date":"Wed, 20 Sep 2017 14:43:09 +0300","Message-Id":"<20170920114310.13080-2-el13635@mail.ntua.gr>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170920114310.13080-1-el13635@mail.ntua.gr>","References":"<20170920114310.13080-1-el13635@mail.ntua.gr>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2001:648:2000:de::183","Subject":"[Qemu-devel] [PATCH 1/2] block/block-backend.c: add\n\tblk_check_byte_request call to blk_pread/blk_pwrite","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,\n\tqemu-block <qemu-block@nongnu.org>, Max Reitz <mreitz@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"blk_check_byte_request() is called from the blk_co_pwritev/blk_co_preadv to\ncheck if the request offset and request bytes parameters are valid for the\ngiven Blockbackend. Let's do that in blk_pread/blk_pwrite too.\n\nSigned-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>\n---\n block/block-backend.c | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)","diff":"diff --git a/block/block-backend.c b/block/block-backend.c\nindex 45d9101be3..110a52d5b1 100644\n--- a/block/block-backend.c\n+++ b/block/block-backend.c\n@@ -1288,22 +1288,23 @@ BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset,\n \n int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int count)\n {\n-    int ret = blk_prw(blk, offset, buf, count, blk_read_entry, 0);\n+    int ret = blk_check_byte_request(blk, offset, count);\n     if (ret < 0) {\n         return ret;\n     }\n-    return count;\n+    ret = blk_prw(blk, offset, buf, count, blk_read_entry, 0);\n+    return ret < 0 ? ret : count;\n }\n \n int blk_pwrite(BlockBackend *blk, int64_t offset, const void *buf, int count,\n                BdrvRequestFlags flags)\n {\n-    int ret = blk_prw(blk, offset, (void *) buf, count, blk_write_entry,\n-                      flags);\n+    int ret = blk_check_byte_request(blk, offset, count);\n     if (ret < 0) {\n         return ret;\n     }\n-    return count;\n+    ret = blk_prw(blk, offset, (void *) buf, count, blk_write_entry, flags);\n+    return ret < 0 ? ret : count;\n }\n \n int64_t blk_getlength(BlockBackend *blk)\n","prefixes":["1/2"]}