From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyrill Gorcunov Subject: [PATCH] kvm tools, 9p: Test for tuncation result Date: Sat, 21 May 2011 16:10:34 +0400 Message-ID: <4DD7ABBA.6090405@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE To: Pekka Enberg , Ingo Molnar , Asias He , Chaitanya Kulkarni , Prasad Joshi Received: from mail-ew0-f46.google.com ([209.85.215.46]:65381 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751494Ab1EUMKi (ORCPT ); Sat, 21 May 2011 08:10:38 -0400 Received: by ewy4 with SMTP id 4so1398867ewy.19 for ; Sat, 21 May 2011 05:10:36 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: Without 'ret' usage I get | cyrill@sun kvm $ make | CC virtio/9p.o | virtio/9p.c: In function =E2=80=98virtio_p9_wstat=E2=80=99: | virtio/9p.c:448:6: error: variable =E2=80=98res=E2=80=99 set but not= used [-Werror=3Dunused-but-set-variable] | cc1: all warnings being treated as errors | make: *** [virtio/9p.o] Error 1 so add a basic check for ftruncate result, this eliminate warning and we might need to use 'res' status later in caller code. Signed-off-by: Cyrill Gorcunov CC: Sasha Levin --- Pekka, are you fine with 'kvm-tools,9p' prefix? tools/kvm/virtio/9p.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Index: linux-2.6.git/tools/kvm/virtio/9p.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-2.6.git.orig/tools/kvm/virtio/9p.c +++ linux-2.6.git/tools/kvm/virtio/9p.c @@ -445,7 +445,7 @@ static bool virtio_p9_wstat(struct p9_ms struct p9_twstat *twstat =3D (struct p9_twstat *)msg->msg; struct p9_str *str; struct p9_fid *fid =3D &p9dev.fids[twstat->fid]; - int res; + int res =3D 0; if (twstat->stat.length !=3D -1UL) res =3D ftruncate(fid->fd, twstat->stat.length); @@ -472,7 +472,8 @@ static bool virtio_p9_wstat(struct p9_ms *outlen =3D VIRTIO_P9_HDR_LEN; set_p9msg_hdr(outmsg, *outlen, P9_RWSTAT, msg->tag); - return true; + + return res =3D=3D 0; } static bool virtio_p9_remove(struct p9_msg *msg, u32 len, struct iovec= *iov, u32 *outlen)