Received: by 2002:a19:c345:0:0:0:0:0 with SMTP id t66csp993380lff; Fri, 10 Jan 2020 09:41:11 -0800 (PST) X-Google-Smtp-Source: APXvYqwhE5n3rVPEdF00LRHQLqt/cGxcTgeOG/Gy4zDtXx/ly009k1246w+LJANAipyCvh7avNMN X-Received: by 2002:aa7:da42:: with SMTP id w2mr4721608eds.3.1578678071837; Fri, 10 Jan 2020 09:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578678071; cv=none; d=google.com; s=arc-20160816; b=aa9wQz2BhRDIU0wP3+HuCpC0bUae+KXY49RG/tzOsiyPhMwc9Gyvx6HqOSPoxuBY/W TRczIGCGYC/oF0pHMyUgelSukjMHAZsM9jUEZ07Xjs+mU4CTx86CaTSg6MBpubv6FyCj PFkEnGvQQDXNo4QxIucWsR4Ghavo3OcE7yWHiWVRW0zbAJOnI5k3c4rhxxnYFVKF3DV0 d3DV6/J+bcv043eVCgWclOGWIdxKb/Xy8GIY9RDvBpLr0QAjapnWFeL/JuFLOiHipAHh weJzffhIyaUsZhjrF+PGdo3wzif9XmEkypo8RmCnmLi/goQrKm7W/LMsMYL1jMMeM/NZ YFKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=2p0QKCeBS4+LZOVYBokhIHTSESXgTmLYzL/BOFYcXF4=; b=pYsTDHfIBHA9bQqNG5bg7n8ZzKQHAovEnY/DoX2Sy5dBql5+bb+6xR74YV17293Hb0 5L/A+/TqnN4IxYbFEzQfMmk2MqVRTGUl6DbnHcMKg1EhNQeizVYXuA687OQR/CR2aLK5 QKjMG7wbDiQorCEPYGVhmbyHz1O7hKgF2p+G3slHFTC8KJ7i3FQvjNB9B12/S/1mhOk9 OhSIOrHElN+V3utDi3ZT/CpWpDR4uzHPT3A3vgvrTrcVgZssW/Z67HmPHKIftes+qezF F4T4YPhrlsr1VvocT59iwyCAtxAGZq9OwSrAP+IQxaIj2MFc+0NDmRY31V99uHrHnFbC zIfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=hg5JRXqd; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id om20si1788323ejb.120.2020.01.10.09.41.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Jan 2020 09:41:11 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=hg5JRXqd; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:49892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipyHW-0005Ad-Rh for alex.bennee@linaro.org; Fri, 10 Jan 2020 12:41:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47568) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipyAY-0004aq-S3 for qemu-arm@nongnu.org; Fri, 10 Jan 2020 12:33:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipyAX-0003GU-LX for qemu-arm@nongnu.org; Fri, 10 Jan 2020 12:33:58 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:48563 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ipyAX-0003EO-Hr for qemu-arm@nongnu.org; Fri, 10 Jan 2020 12:33:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578677637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2p0QKCeBS4+LZOVYBokhIHTSESXgTmLYzL/BOFYcXF4=; b=hg5JRXqdMh6qHgYiRfAXEKPdvAT3/+1GOeX3rRaG7THxanYb0nBQ6sKajaAG6rvfqRocee 7Omve2CbWL7K8i7BgruqCcW664O6LA/IlklGz2kvy3U8Adk4vCrbyjO16EWUAkartx2+gN NHwzBhIDftLGgYJbIEUsgvIbHmnJ9uQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-24-nGu7bzSpOF-94JielOxiyg-1; Fri, 10 Jan 2020 12:33:55 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C04C1005513; Fri, 10 Jan 2020 17:33:53 +0000 (UTC) Received: from secure.mitica (ovpn-116-240.ams2.redhat.com [10.36.116.240]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F4FD19C4F; Fri, 10 Jan 2020 17:33:46 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 11/28] misc: use QEMU_IS_ALIGNED Date: Fri, 10 Jan 2020 18:31:58 +0100 Message-Id: <20200110173215.3865-12-quintela@redhat.com> In-Reply-To: <20200110173215.3865-1-quintela@redhat.com> References: <20200110173215.3865-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: nGu7bzSpOF-94JielOxiyg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Corey Minyard , Thomas Huth , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Juan Quintela , Peter Maydell , Stefan Weil , Jason Wang , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, David Gibson , Marcel Apfelbaum , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Stefan Berger , Andrzej Zaborowski , Richard Henderson Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: wD6RsMosNpd/ From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Berger Reviewed-by: Paolo Bonzini Signed-off-by: Juan Quintela --- exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index d4b769d0d4..1feda49ca1 100644 --- a/exec.c +++ b/exec.c @@ -3895,7 +3895,7 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t st= art, size_t length) =20 uint8_t *host_startaddr =3D rb->host + start; =20 - if ((uintptr_t)host_startaddr & (rb->page_size - 1)) { + if (!QEMU_PTR_IS_ALIGNED(host_startaddr, rb->page_size)) { error_report("ram_block_discard_range: Unaligned start address: %p= ", host_startaddr); goto err; @@ -3903,7 +3903,7 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t st= art, size_t length) =20 if ((start + length) <=3D rb->used_length) { bool need_madvise, need_fallocate; - if (length & (rb->page_size - 1)) { + if (!QEMU_IS_ALIGNED(length, rb->page_size)) { error_report("ram_block_discard_range: Unaligned length: %zx", length); goto err; --=20 2.24.1