From patchwork Fri Oct 20 12:02:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 10020191 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 54AE5602CB for ; Fri, 20 Oct 2017 12:34:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 475BB28E7E for ; Fri, 20 Oct 2017 12:34:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C12428EA8; Fri, 20 Oct 2017 12:34:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A2E9228E7E for ; Fri, 20 Oct 2017 12:34:54 +0000 (UTC) Received: from localhost ([::1]:53624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5WVp-0005Xm-RB for patchwork-qemu-devel@patchwork.kernel.org; Fri, 20 Oct 2017 08:34:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5W1K-0001xF-7C for qemu-devel@nongnu.org; Fri, 20 Oct 2017 08:03:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5W1G-0007xm-9p for qemu-devel@nongnu.org; Fri, 20 Oct 2017 08:03:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54242) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e5W1G-0007w6-3Q for qemu-devel@nongnu.org; Fri, 20 Oct 2017 08:03:18 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 270B7432B3; Fri, 20 Oct 2017 12:03:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 270B7432B3 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=stefanha@redhat.com Received: from localhost (ovpn-117-65.ams2.redhat.com [10.36.117.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1071B5BD41; Fri, 20 Oct 2017 12:03:11 +0000 (UTC) From: Stefan Hajnoczi To: Date: Fri, 20 Oct 2017 14:02:35 +0200 Message-Id: <20171020120235.29142-2-stefanha@redhat.com> In-Reply-To: <20171020120235.29142-1-stefanha@redhat.com> References: <20171020120235.29142-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 20 Oct 2017 12:03:17 +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] [PULL 1/1] oslib-posix: Fix compiler warning and some data types 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: Peter Maydell , Stefan Hajnoczi , Stefan Weil Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Stefan Weil gcc warning: /qemu/util/oslib-posix.c:304:11: error: variable ‘addr’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] Fix also some related data types: numpages, hpagesize are used as pointer offset. Always use size_t for them and also for the derived numpages_per_thread and size_per_thread. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Stefan Weil Message-id: 20171016202912.1117-1-sw@weilnetz.de Signed-off-by: Stefan Hajnoczi --- util/oslib-posix.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 80086c549f..382bd4a231 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -59,8 +59,8 @@ struct MemsetThread { char *addr; - uint64_t numpages; - uint64_t hpagesize; + size_t numpages; + size_t hpagesize; QemuThread pgthread; sigjmp_buf env; }; @@ -301,11 +301,7 @@ static void sigbus_handler(int signal) static void *do_touch_pages(void *arg) { MemsetThread *memset_args = (MemsetThread *)arg; - char *addr = memset_args->addr; - uint64_t numpages = memset_args->numpages; - uint64_t hpagesize = memset_args->hpagesize; sigset_t set, oldset; - int i = 0; /* unblock SIGBUS */ sigemptyset(&set); @@ -315,6 +311,10 @@ static void *do_touch_pages(void *arg) if (sigsetjmp(memset_args->env, 1)) { memset_thread_failed = true; } else { + char *addr = memset_args->addr; + size_t numpages = memset_args->numpages; + size_t hpagesize = memset_args->hpagesize; + size_t i; for (i = 0; i < numpages; i++) { /* * Read & write back the same value, so we don't @@ -351,7 +351,8 @@ static inline int get_memset_num_threads(int smp_cpus) static bool touch_all_pages(char *area, size_t hpagesize, size_t numpages, int smp_cpus) { - uint64_t numpages_per_thread, size_per_thread; + size_t numpages_per_thread; + size_t size_per_thread; char *addr = area; int i = 0;