From nobody Mon Feb 9 17:59:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516354998836236.91254247842107; Fri, 19 Jan 2018 01:43:18 -0800 (PST) Received: from localhost ([::1]:38358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecTCL-0003BC-1l for importer@patchew.org; Fri, 19 Jan 2018 04:42:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecTAC-0001lm-UO for qemu-devel@nongnu.org; Fri, 19 Jan 2018 04:40:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecTAC-0000GO-0k for qemu-devel@nongnu.org; Fri, 19 Jan 2018 04:40:44 -0500 Received: from ozlabs.org ([103.22.144.67]:52811) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ecTAA-00007a-Uq for qemu-devel@nongnu.org; Fri, 19 Jan 2018 04:40:43 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3zNG5k1rzKz9t44; Fri, 19 Jan 2018 20:40:25 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1516354826; bh=Yr3m0DgMhuNQiMUxqwI/Fi6QBG9fOOHXE/XtkUlIo2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KRilXtbp77yztcyrMlIcREU/eblGBaHjZezRPgMmq88hGtwGNOtJ5cY1NMCSiFb/m Uk3gRNFJs3k/vsviauFnl7fE4coTVPRuW06vVuh9HFR1VUlrDhJYea4WXKF6Jeg8kC VQjbqigOomQs0Y/yEfjOV/YeT7tKl8LmCFZokutE= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 19 Jan 2018 20:40:13 +1100 Message-Id: <20180119094015.28266-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180119094015.28266-1-david@gibson.dropbear.id.au> References: <20180119094015.28266-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 11/13] sii3112: Add explicit type casts to avoid unintended sign extension 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: , Cc: lvivier@redhat.com, qemu-ppc@nognu.org, surajjs@au1.ibm.com, agraf@suse.de, qemu-devel@nongnu.org, groug@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Noticed by Coverity Reported-by: Peter Maydell Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/ide/sii3112.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c index e2f5562bb7..17aa930e39 100644 --- a/hw/ide/sii3112.c +++ b/hw/ide/sii3112.c @@ -79,13 +79,13 @@ static uint64_t sii3112_reg_read(void *opaque, hwaddr a= ddr, val |=3D (d->regs[0].confstat & (1UL << 11) ? (1 << 4) : 0); /*SAT= AINT0*/ val |=3D (d->regs[1].confstat & (1UL << 11) ? (1 << 6) : 0); /*SAT= AINT1*/ val |=3D (d->i.bmdma[1].status & BM_STATUS_INT ? (1 << 14) : 0); - val |=3D d->i.bmdma[0].status << 16; - val |=3D d->i.bmdma[1].status << 24; + val |=3D (uint32_t)d->i.bmdma[0].status << 16; + val |=3D (uint32_t)d->i.bmdma[1].status << 24; break; case 0x18: val =3D d->i.bmdma[1].cmd; val |=3D (d->regs[1].confstat & (1UL << 11) ? (1 << 4) : 0); - val |=3D d->i.bmdma[1].status << 16; + val |=3D (uint32_t)d->i.bmdma[1].status << 16; break; case 0x80 ... 0x87: if (size =3D=3D 1) { @@ -128,7 +128,7 @@ static uint64_t sii3112_reg_read(void *opaque, hwaddr a= ddr, val =3D (d->i.bus[0].ifs[0].blk) ? 0x113 : 0; break; case 0x148: - val =3D d->regs[0].sien << 16; + val =3D (uint32_t)d->regs[0].sien << 16; break; case 0x180: val =3D d->regs[1].scontrol; @@ -137,7 +137,7 @@ static uint64_t sii3112_reg_read(void *opaque, hwaddr a= ddr, val =3D (d->i.bus[1].ifs[0].blk) ? 0x113 : 0; break; case 0x1c8: - val =3D d->regs[1].sien << 16; + val =3D (uint32_t)d->regs[1].sien << 16; break; default: val =3D 0; --=20 2.14.3