From patchwork Mon Oct 8 14:00:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 148404 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp3725152lji; Mon, 8 Oct 2018 07:32:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV61BA77uEBCSCcLCUYsTYYPqOgBjGM6Sbubf/vfeJyfgRmlBH8WGHtEuHWt3MHvbRvrs2T3h X-Received: by 2002:a37:4787:: with SMTP id u129-v6mr19044544qka.301.1539009168949; Mon, 08 Oct 2018 07:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539009168; cv=none; d=google.com; s=arc-20160816; b=hk0DXHBkC2KjSKJkfmvfYwJR1j3lY9jYA462yRixIB8g7YSy65AA+NWbCiLT6atdGf NDv2Y8auNJbfsxrL3GT58vMCITGf0rkCjoUy6bt//UPUxg+dIGC5uVtdnaFU0Kr07SDN Hxax1n14jVm1s1XxK/WiN/7uEF3EsPD56S7jSkACYom+wnEjKuTG+dJYNLsbhzpnDBrd q0aeH+PrW0Osmgl00jZQCfpLlEQ94lIuy0wANcEaP4mEPLhj7ahsz8nPKR+k4Hf9u8YC wW5ihfLs93AX0UqCgpbcf7qkP54sO7eCoaTEug0THaF0e3anvTWp8n4901lawAtX/LfY ruPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=lv5+haR4jS04tha9Ick+beqDvTT7Z6+nIaPWGt5c/MY=; b=jxIlMYTTgmuu0/uuUWcJdjA9dAmOmqwL7KDpbhYvriiHrUgH4e9Q/LQWXqnEiiU3l+ H0b09YKRfvl0/+JE5ejVJmmysiUDlsYuqfGlIwIM0meFOgZJCTs8lXZ9yX1ZFcmDv/iv xHawQyhQEXTQkAi1oHTKr8vKYufI2gz10KlhuQ5+nzbmQJ6xdFAsadZV0C2Ym7NdCvZ1 tJga5xIfJR3xRZCjDLnvU4mXrYepb2CuEiHeq1ehmEeAc7XlUOpjjpyJLJTxEVjbp4I+ XGLQDggk17YmAFhfy6EoFEX4dUaGUFojnadNgOdBfVGVGFPm4gKoWrXj5gKx9XV3s78M J18g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 14si968937qvv.27.2018.10.08.07.32.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 08 Oct 2018 07:32:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9WaW-000193-EQ for patch@linaro.org; Mon, 08 Oct 2018 10:32:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9W5y-0001Wz-7z for qemu-devel@nongnu.org; Mon, 08 Oct 2018 10:01:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9W5w-0007S2-Uy for qemu-devel@nongnu.org; Mon, 08 Oct 2018 10:01:14 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:51696) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g9W5w-00073I-LU for qemu-devel@nongnu.org; Mon, 08 Oct 2018 10:01:12 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1g9W5T-0003ly-Db for qemu-devel@nongnu.org; Mon, 08 Oct 2018 15:00:43 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 8 Oct 2018 15:00:04 +0100 Message-Id: <20181008140004.12612-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008140004.12612-1-peter.maydell@linaro.org> References: <20181008140004.12612-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 33/33] hw/display/bcm2835_fb: Silence Coverity warning about multiply overflow 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Coverity complains (CID 1395628) that the multiply in the calculation of the framebuffer base is performed as 32x32 but then used in a context that takes a 64-bit hwaddr. This can't actually ever overflow the 32-bit result, because of the constraints placed on the s->config values in bcm2835_fb_validate_config(). But we can placate Coverity anyway, by explicitly casting one of the inputs to a hwaddr, so the whole expression is calculated with 64-bit arithmetic. Signed-off-by: Peter Maydell Reviewed-by: Paolo Bonzini Message-id: 20181005133012.26490-1-peter.maydell@linaro.org --- hw/display/bcm2835_fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.0 diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c index d534d00a65f..599863e4e17 100644 --- a/hw/display/bcm2835_fb.c +++ b/hw/display/bcm2835_fb.c @@ -190,7 +190,7 @@ static void fb_update_display(void *opaque) } if (s->invalidate) { - hwaddr base = s->config.base + xoff + yoff * src_width; + hwaddr base = s->config.base + xoff + (hwaddr)yoff * src_width; framebuffer_update_memory_section(&s->fbsection, s->dma_mr, base, s->config.yres, src_width);