From patchwork Fri May 14 12:15:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 438901 Delivered-To: patch@linaro.org Received: by 2002:a02:b78d:0:0:0:0:0 with SMTP id f13csp294068jam; Fri, 14 May 2021 05:27:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlFiUneLz30vhC2y6YE6p6tBzbTAwqDzQi9MPVPBjVndsZbffiRNNd2bSHyz9NUwcquCh9 X-Received: by 2002:a92:c5aa:: with SMTP id r10mr3854107ilt.89.1620995269112; Fri, 14 May 2021 05:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620995269; cv=none; d=google.com; s=arc-20160816; b=w41n7cYQgleXx8DpwYhLCUl1DezbcPxyGQFI94ui7/8WTCc+veEQhKlZHzI8UFGVOX rfHUJX+XqIBpksoNfg+hof0/owsL0jaaatBWqaJ65jT9ipRerzab88BdZeoVkVLfCX+C E7MXwaCVY2qneUKux7r2lzRFmi+lQ+w8YW1MusBcGfMTKHni/1t4RsWw7b6RxiDdGMoo Qxurm/Dx4rSBYb9wU1XJHg2MMak0GcX9bsHER5ZLe514DF/bmdo3H7rbq1jt9x55AICE H2G42KV4jYuAGypeUfRPIEyYPOePZMcGoyZYIxkD7ak7+hXSMpTecuj6dkTb7p4mPERk FbVg== 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=/cjNEe0Ie8oBRIjqHrPIm4Ve53eJLvdLKvseQ78mcfw=; b=aaofFolU6RvY4ktGLU8FAkycvXyE8DQuwBznN6jSj6F2i7oY1zeUr0zo7/fpkNKRE0 ICEODm6ddggnjDrSLGxJj53NXib76+2jfEshFzAj6W6U+4QLq7o/3ckShtkrUQ3hbAF6 Xnp3W3UG4LYRCOn5MvtDPVlDhbwAizP0wrDjLo7Qn9/nscheGQ2ul7chlpkVedUvFssi fmeAsnSQ4UTuByyCy2qho/HK5nKZMRpKcdQnnqJfDv6Btwv1NkgNHBZOZOpmZHOnqFEA kU9th/z9GBhuT8hhxXETFlw5DvQQrzmEYJeDNEGkOLxTBNTNpYLMZ9UtiDoMKnvpDTGN MuYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b="i/Wsod6y"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=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 h5si8624348iol.44.2021.05.14.05.27.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 May 2021 05:27:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=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="i/Wsod6y"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:34816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhWuy-0000zO-Gx for patch@linaro.org; Fri, 14 May 2021 08:27:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhWjq-00015u-KR for qemu-devel@nongnu.org; Fri, 14 May 2021 08:16:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34359) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhWjd-0005BG-1w for qemu-devel@nongnu.org; Fri, 14 May 2021 08:16:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620994563; 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=/cjNEe0Ie8oBRIjqHrPIm4Ve53eJLvdLKvseQ78mcfw=; b=i/Wsod6yJ+ZzqMUQXQc6iKlp23mBHxTL8N0wRS9FrvKX/HAWl0U9+PID853xHtLGiuwNnR BqDkb8j9shB8HbWIP4uQLumyWWg9T+dkzSnEsJMCve+tFFzl57BKXBLiuVcOQA2MPAs55u EwnMdXg+yLl+QyXf2S1rTlp38hFvFBg= 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-189-Q4eD961OOQG7LxxaShgIpw-1; Fri, 14 May 2021 08:16:01 -0400 X-MC-Unique: Q4eD961OOQG7LxxaShgIpw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9A4429F932; Fri, 14 May 2021 12:15:59 +0000 (UTC) Received: from thuth.com (ovpn-112-191.ams2.redhat.com [10.36.112.191]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EBB16060F; Fri, 14 May 2021 12:15:57 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 09/20] tests/qtest/ahci-test.c: Calculate iso_size with 64-bit arithmetic Date: Fri, 14 May 2021 14:15:07 +0200 Message-Id: <20210514121518.832729-10-thuth@redhat.com> In-Reply-To: <20210514121518.832729-1-thuth@redhat.com> References: <20210514121518.832729-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: John Snow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Coverity notes that when calculating the 64-bit iso_size value in ahci_test_cdrom() we actually only do it with 32-bit arithmetic. This doesn't matter for the current test code because nsectors is always small; but adding the cast avoids the coverity complaints. Fixes: Coverity CID 1432343 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: John Snow Message-Id: <20210506194358.3925-1-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- tests/qtest/ahci-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.27.0 diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index 5e1954852e..8073ccc205 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -1491,14 +1491,14 @@ static void ahci_test_cdrom(int nsectors, bool dma, uint8_t cmd, char *iso; int fd; AHCIOpts opts = { - .size = (ATAPI_SECTOR_SIZE * nsectors), + .size = ((uint64_t)ATAPI_SECTOR_SIZE * nsectors), .atapi = true, .atapi_dma = dma, .post_cb = ahci_cb_cmp_buff, .set_bcl = override_bcl, .bcl = bcl, }; - uint64_t iso_size = ATAPI_SECTOR_SIZE * (nsectors + 1); + uint64_t iso_size = (uint64_t)ATAPI_SECTOR_SIZE * (nsectors + 1); /* Prepare ISO and fill 'tx' buffer */ fd = prepare_iso(iso_size, &tx, &iso);