From patchwork Wed Aug 23 08:39:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 804897 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xch5h1GHLz9sDB for ; Wed, 23 Aug 2017 18:52:54 +1000 (AEST) Received: from localhost ([::1]:42520 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkRPA-0002N1-4u for incoming@patchwork.ozlabs.org; Wed, 23 Aug 2017 04:52:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkRL5-0008Nd-4j for qemu-devel@nongnu.org; Wed, 23 Aug 2017 04:48:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dkRL2-0003M7-2b for qemu-devel@nongnu.org; Wed, 23 Aug 2017 04:48:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34492) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dkRL1-0003Lu-T4 for qemu-devel@nongnu.org; Wed, 23 Aug 2017 04:48:36 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC4D9C04B310 for ; Wed, 23 Aug 2017 08:39:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AC4D9C04B310 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com Received: from secure.mitica (ovpn-117-155.ams2.redhat.com [10.36.117.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04680704A9; Wed, 23 Aug 2017 08:39:06 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 23 Aug 2017 10:39:00 +0200 Message-Id: <20170823083901.852-2-quintela@redhat.com> In-Reply-To: <20170823083901.852-1-quintela@redhat.com> References: <20170823083901.852-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 23 Aug 2017 08:39:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/2] tests: Use real size for iov tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, pbonzini@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We were using -1 instead of the real size because the functions check what is bigger, size in bytes or the size of the iov. Recent gcc's barf at this. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/test-iov.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test-iov.c b/tests/test-iov.c index a22d71fd2c..819c410a51 100644 --- a/tests/test-iov.c +++ b/tests/test-iov.c @@ -81,17 +81,17 @@ static void test_to_from_buf_1(void) * skip whole vector and process exactly 0 bytes */ /* first set bytes [i..sz) to some "random" value */ - n = iov_memset(iov, niov, 0, 0xff, -1); + n = iov_memset(iov, niov, 0, 0xff, sz); g_assert(n == sz); /* next copy bytes [i..sz) from ibuf to iovec */ - n = iov_from_buf(iov, niov, i, ibuf + i, -1); + n = iov_from_buf(iov, niov, i, ibuf + i, sz - i); g_assert(n == sz - i); /* clear part of obuf */ memset(obuf + i, 0, sz - i); /* and set this part of obuf to values from iovec */ - n = iov_to_buf(iov, niov, i, obuf + i, -1); + n = iov_to_buf(iov, niov, i, obuf + i, sz - i); g_assert(n == sz - i); /* now compare resulting buffers */ @@ -109,7 +109,7 @@ static void test_to_from_buf_1(void) * with j in [i..sz]. */ /* clear iovec */ - n = iov_memset(iov, niov, 0, 0xff, -1); + n = iov_memset(iov, niov, 0, 0xff, sz); g_assert(n == sz); /* copy bytes [i..j) from ibuf to iovec */