Received: from eggs.gnu.org ([2001:4830:134:3::10]:44174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dddAf-000424-9E for qemu-devel@nongnu.org; Fri, 04 Aug 2017 10:02:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dddA2-0005Q8-OU for qemu-devel@nongnu.org; Fri, 04 Aug 2017 10:01:45 -0400 From: Markus Armbruster Date: Fri, 04 Aug 2017 15:55:39 +0200 Message-ID: <87d18be8tg.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] Is blk_getlength() in find_image_format() and img_map() kosher? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Max Reitz Have a look at find_image_format(): if (blk_is_sg(file) || !blk_is_inserted(file) || blk_getlength(file) == 0) { *pdrv = &bdrv_raw; return ret; } blk_getlength() can fail. Shouldn't we error out then? We pretty obviously should in img_map(): length = blk_getlength(blk); while (curr.start + curr.length < length) { Since I have to touch @length in the series I'm working on, I'll stick in a fix.