From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8989C433E0 for ; Fri, 24 Jul 2020 13:20:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 749392065F for ; Fri, 24 Jul 2020 13:20:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YFZnEp7/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 749392065F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyxd2-0004AM-Pd for qemu-devel@archiver.kernel.org; Fri, 24 Jul 2020 09:20:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyxcG-0003Qw-AS for qemu-devel@nongnu.org; Fri, 24 Jul 2020 09:20:00 -0400 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]:39413) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jyxcD-0008JL-La for qemu-devel@nongnu.org; Fri, 24 Jul 2020 09:20:00 -0400 Received: by mail-ot1-x32d.google.com with SMTP id 18so6953249otv.6 for ; Fri, 24 Jul 2020 06:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=jTEf1o++WaVJfH5RXYmaRp2hBzAR3Y42Mk52reBi4WA=; b=YFZnEp7/W2ybtHY5mYiOP77ckpKkeOvV24exIgBLSWYQ1qi+05rPNOUOEWQvaIq/h6 0HcGDkdEIxEVRS/IJgdnO1v2vsOE1VXMmBXrl+TrWiAX1Vc1eZO7Ec/I6k1EG+VmJldf vXaBz0gKSqob+H5eLh3r9TDm+o3p+rEGIOBVtKiX3RWZJuHwW+9KCisK5dZ003nocBnX UWhmSG9WtNrzbkgE+xe1cXTBnsxseS1pPpC3xXPr59XxKHe8vCnhVQuysIOsBJqG6oht s4aPZ7hknS/XpDFuKnkYBKhLLix58PGosMYbK+SftlEEYPWM35dzyNAH10bq7oQezgB5 xZFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=jTEf1o++WaVJfH5RXYmaRp2hBzAR3Y42Mk52reBi4WA=; b=tLPH909JRcwzP8N2H9YZPBQhuJ7uA2vYJxieKI7gBKUsJv1Qw+khia2gQKMn09nUYQ dO6PdN+d71a9G+BNXPKNRWth1erVZg01CyNLHpmANnVrPUp7pkBBWPoGx0mSBQN7JQjC /OcG9Z7SQtGh1bYcuW/o7ZIwjcatB/rSzbu0/SdrcWlfdd1+lr5WJYdlDuLgWQO9aFHj 3NoF7H1wayGLd2t9sN0jeGSCAD4MOz2YQPP5shHSrWYAqSkENAaxGfty2JEmJalH1GUK hmpTPozctKgCQHfPGHI/+vdsOJmO8llPSBTDaP/VxRgYxF30OyiD0hwBZm6QbE9jtUW7 hXJA== X-Gm-Message-State: AOAM533mzENQdRKm/FQYnsgZE6ul/2YkHU/M7Vd2NK7TqgunxPaxll4q LtuGwrf5NIc/3YECHLFKchvX857CG1/FKzCSx38CCA== X-Google-Smtp-Source: ABdhPJyM9eLqy2fs/eTDUfDNPXA7asIAcsJIFHdNItKNLOei76J2z4NNzo1Ekh5f++WB65Edzj5vjj96X6hWeD8U+Hk= X-Received: by 2002:a05:6830:1bd3:: with SMTP id v19mr8710838ota.91.1595596796072; Fri, 24 Jul 2020 06:19:56 -0700 (PDT) MIME-Version: 1.0 References: <20200721124250.8601-1-f4bug@amsat.org> In-Reply-To: <20200721124250.8601-1-f4bug@amsat.org> From: Peter Maydell Date: Fri, 24 Jul 2020 14:19:45 +0100 Message-ID: Subject: Re: [PATCH-for-5.1 v3] hw/misc/aspeed_sdmc: Fix incorrect memory size To: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-ot1-x32d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , QEMU Developers , QEMU Trivial , qemu-arm , Joel Stanley , =?UTF-8?Q?C=C3=A9dric_Le_Goater?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Tue, 21 Jul 2020 at 13:42, Philippe Mathieu-Daud=C3=A9 = wrote: > > The SDRAM Memory Controller has a 32-bit address bus, thus > supports up to 4 GiB of DRAM. There is a signed to unsigned > conversion error with the AST2600 maximum memory size: > > (uint64_t)(2048 << 20) =3D (uint64_t)(-2147483648) > =3D 0xffffffff40000000 > =3D 16 EiB - 2 GiB > > Fix by using the IEC suffixes which are usually safer, and add > an assertion check to verify the memory is valid. This would have > caught this bug: > > $ qemu-system-arm -M ast2600-evb > qemu-system-arm: hw/misc/aspeed_sdmc.c:258: aspeed_sdmc_realize: Assert= ion `asc->max_ram_size < 4 * GiB' failed. > Aborted (core dumped) > > Fixes: 1550d72679 ("aspeed/sdmc: Add AST2600 support") > Reviewed-by: C=C3=A9dric Le Goater > Signed-off-by: Philippe Mathieu-Daud=C3=A9 > -- Applied to target-arm.next, thanks. -- PMM