From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIeRm-0000l5-J0 for qemu-devel@nongnu.org; Tue, 25 Oct 2011 06:41:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RIeRa-0006Nz-9c for qemu-devel@nongnu.org; Tue, 25 Oct 2011 06:41:29 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:35123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIeRY-0006Mv-ER for qemu-devel@nongnu.org; Tue, 25 Oct 2011 06:41:17 -0400 Received: by wwi36 with SMTP id 36so464318wwi.10 for ; Tue, 25 Oct 2011 03:41:14 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 25 Oct 2011 12:40:32 +0200 Message-Id: <1319539241-26436-25-git-send-email-pbonzini@redhat.com> In-Reply-To: <1319539241-26436-1-git-send-email-pbonzini@redhat.com> References: <1319539241-26436-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v2 24/33] scsi-generic: check ioctl statuses when SG_IO succeeds List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com A succeeding ioctl does not imply that the SCSI command succeeded. Fix some braces along the way. Signed-off-by: Paolo Bonzini --- hw/scsi-generic.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c index 5e2d4c0..a5fc2ec 100644 --- a/hw/scsi-generic.c +++ b/hw/scsi-generic.c @@ -310,9 +310,9 @@ static int get_blocksize(BlockDriverState *bdrv) io_header.timeout = 6000; /* XXX */ ret = bdrv_ioctl(bdrv, SG_IO, &io_header); - if (ret < 0) + if (ret < 0 || io_header.driver_status || io_header.host_status) { return -1; - + } return (buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7]; } @@ -341,9 +341,9 @@ static int get_stream_blocksize(BlockDriverState *bdrv) io_header.timeout = 6000; /* XXX */ ret = bdrv_ioctl(bdrv, SG_IO, &io_header); - if (ret < 0) + if (ret < 0 || io_header.driver_status || io_header.host_status) { return -1; - + } return (buf[9] << 16) | (buf[10] << 8) | buf[11]; } -- 1.7.6