From patchwork Thu Aug 30 07:36:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 1386721 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 95080DF264 for ; Thu, 30 Aug 2012 07:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751671Ab2H3Hgm (ORCPT ); Thu, 30 Aug 2012 03:36:42 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:59077 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751307Ab2H3Hgj (ORCPT ); Thu, 30 Aug 2012 03:36:39 -0400 Received: by mail-we0-f174.google.com with SMTP id x8so825950wey.19 for ; Thu, 30 Aug 2012 00:36:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=a0b1eQVtjrQ5qcRuOpYT72yNh/GVIlekTZ5wZh6s64I=; b=hd2vauLE6HZePrYldwBRcSBwFnQzkOQy6t679j1uAzsq+lvN1rLQ0RXS1BLf4cVDfg yZDI/5/XBR1Z5c3b+bFHVZ+VQc/u63HZ8o5w5QfZpxIiXcSycctH6KtVhUZjJh5X393q Pz0aLIibhD1sMFi1Oo+StKSvUt5Ik5hlj3jpRH5uDSP6+Tf4FNhqQqaTpO+i+TGNaE75 a988K3DA/i9r6FlZkJepNke0wwKGecUZrw+8WE/cyjSGKRFY4c7Ex/CeUHZuBlAS3Msd Dc+ZTReT0oZPj5nsi/8yO7mj22hL3n054RKVCG+VBdA7Mp3GgL0YQZJ4VeOIydeWiqFb oeMA== Received: by 10.180.87.34 with SMTP id u2mr34164549wiz.3.1346312198489; Thu, 30 Aug 2012 00:36:38 -0700 (PDT) Received: from lappy.capriciverd.com (20.Red-80-59-140.staticIP.rima-tde.net. [80.59.140.20]) by mx.google.com with ESMTPS id fr4sm2847342wib.8.2012.08.30.00.36.36 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 30 Aug 2012 00:36:37 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: asias.hejun@gmail.com, mingo@elte.hu, gorcunov@openvz.org, kvm@vger.kernel.org, Sasha Levin Subject: [PATCH 4/7] kvm tools: fix warnings in virtio-blk Date: Thu, 30 Aug 2012 09:36:40 +0200 Message-Id: <1346312203-29456-4-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1346312203-29456-1-git-send-email-levinsasha928@gmail.com> References: <1346312203-29456-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Fix up warnings related to not checking return value of read/write by actually handling errors there. Signed-off-by: Sasha Levin --- tools/kvm/virtio/blk.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c index 740442a..d988365 100644 --- a/tools/kvm/virtio/blk.c +++ b/tools/kvm/virtio/blk.c @@ -184,9 +184,12 @@ static void *virtio_blk_thread(void *dev) { struct blk_dev *bdev = dev; u64 data; + int r; while (1) { - read(bdev->io_efd, &data, sizeof(u64)); + r = read(bdev->io_efd, &data, sizeof(u64)); + if (r < 0) + continue; virtio_blk_do_io(bdev->kvm, &bdev->vqs[0], bdev); } @@ -198,8 +201,11 @@ static int notify_vq(struct kvm *kvm, void *dev, u32 vq) { struct blk_dev *bdev = dev; u64 data = 1; + int r; - write(bdev->io_efd, &data, sizeof(data)); + r = write(bdev->io_efd, &data, sizeof(data)); + if (r < 0) + return r; return 0; }