From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJhqF-0000AT-G7 for qemu-devel@nongnu.org; Fri, 06 Feb 2015 07:17:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJhqC-0007Q6-5u for qemu-devel@nongnu.org; Fri, 06 Feb 2015 07:16:59 -0500 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:35033 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJhqB-0007Pf-Sd for qemu-devel@nongnu.org; Fri, 06 Feb 2015 07:16:56 -0500 Message-ID: <54D4B0B3.10107@kamp.de> Date: Fri, 06 Feb 2015 13:16:51 +0100 From: Peter Lieven MIME-Version: 1.0 References: <1423220051-16058-1-git-send-email-pl@kamp.de> <1423221883-16804-1-git-send-email-den@openvz.org> <20150206115347.GB13081@noname.redhat.com> In-Reply-To: <20150206115347.GB13081@noname.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/1] nbd: fix max_discard/max_transfer_length List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , "Denis V. Lunev" Cc: qemu-devel@nongnu.org Am 06.02.2015 um 12:53 schrieb Kevin Wolf: > Am 06.02.2015 um 12:24 hat Denis V. Lunev geschrieben: >> nbd_co_discard calls nbd_client_session_co_discard which uses uint32_t >> as the length in bytes of the data to discard due to the following >> definition: >> >> struct nbd_request { >> uint32_t magic; >> uint32_t type; >> uint64_t handle; >> uint64_t from; >> uint32_t len; <-- the length of data to be discarded, in bytes >> } QEMU_PACKED; >> >> Thus we should limit bl_max_discard to UINT32_MAX >> BDRV_SECTOR_BITS to >> avoid overflow. >> >> NBD read/write code uses the same structure for transfers. Fix >> max_transfer_length accordingly. >> >> Signed-off-by: Denis V. Lunev >> CC: Peter Lieven >> CC: Kevin Wolf > Thanks, I have applied both Peter's and your patch. Can you guys please > check whether the current state of my block branch is correct or whether > I forgot to include or remove some patch? Looks good from my point of view. Just to be sure has it to be if (size > BDRV_REQUEST_MAX_SECTORS << BDRV_SECTOR_BITS) or if (size > (BDRV_REQUEST_MAX_SECTORS << BDRV_SECTOR_BITS)) ? If the latter is right, can you please fix that line in my patch. I am afk now. Thanks, Peter