Message ID | 20190312085502.8203-19-david@gibson.dropbear.id.au (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3575F6C2 for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 12 Mar 2019 09:11:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22216294E3 for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 12 Mar 2019 09:11:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 205E4294D0; Tue, 12 Mar 2019 09:11:25 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 803E6295AB for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 12 Mar 2019 09:11:24 +0000 (UTC) Received: from localhost ([127.0.0.1]:47812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) id 1h3dRT-0006PX-FS for patchwork-qemu-devel@patchwork.kernel.org; Tue, 12 Mar 2019 05:11:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <dgibson@ozlabs.org>) id 1h3dCh-0002Af-Uj for qemu-devel@nongnu.org; Tue, 12 Mar 2019 04:56:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <dgibson@ozlabs.org>) id 1h3dCc-0001uT-3q for qemu-devel@nongnu.org; Tue, 12 Mar 2019 04:56:07 -0400 Received: from ozlabs.org ([203.11.71.1]:45937) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <dgibson@ozlabs.org>) id 1h3dCb-0001Ya-Nu; Tue, 12 Mar 2019 04:56:02 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44JTMM3NLWz9sPD; Tue, 12 Mar 2019 19:55:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1552380927; bh=pd3/Zt9I+QIf5SvUUcCcPyaQnV4kkikhQmRPeT+U5kw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NuSQqZtBfuV6unQXEykSO5sdAyKyxKDCXqEzzRcWPY+IDjk0qHZWfKUCGvbtx60+V p8+qE/Sp9QsPYoKfIaA0Sq8vH6U9svt0Y3WOW2F1U5CpjksbtatHUjgAmQn0rbZn2e OT91zXWP1sFFSZhpXFRnRLPq+Z7Aehm/xCy0TfeI= From: David Gibson <david@gibson.dropbear.id.au> To: peter.maydell@linaro.org Date: Tue, 12 Mar 2019 19:54:18 +1100 Message-Id: <20190312085502.8203-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190312085502.8203-1-david@gibson.dropbear.id.au> References: <20190312085502.8203-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 18/62] spapr: Force SPAPR_MEMORY_BLOCK_SIZE to be a hwaddr (64-bit) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson <david@gibson.dropbear.id.au> Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
[PULL,01/62] vfio/spapr: Fix indirect levels calculation
|
expand
|
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index ff1bd60615..1311ebe28e 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -792,7 +792,7 @@ int spapr_rtc_import_offset(sPAPRRTCState *rtc, int64_t legacy_offset); #define TYPE_SPAPR_RNG "spapr-rng" -#define SPAPR_MEMORY_BLOCK_SIZE (1 << 28) /* 256MB */ +#define SPAPR_MEMORY_BLOCK_SIZE ((hwaddr)1 << 28) /* 256MB */ /* * This defines the maximum number of DIMM slots we can have for sPAPR
SPAPR_MEMORY_BLOCK_SIZE is logically a difference in memory addresses, and hence of type hwaddr which is 64-bit. Previously it wasn't marked as such which means that it could be treated as 32-bit. That will work in some circumstances but if multiplied by another 32-bit value it could lead to a 32-bit overflow and an incorrect result. One specific instance of this in spapr_lmb_dt_populate() was spotted by Coverity (CID 1399145). Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> --- include/hw/ppc/spapr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)