From patchwork Wed Jan 21 12:41:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Blaschka X-Patchwork-Id: 431458 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 62EA0140213 for ; Wed, 21 Jan 2015 23:41:53 +1100 (AEDT) Received: from localhost ([::1]:47775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDubX-0004vp-EC for incoming@patchwork.ozlabs.org; Wed, 21 Jan 2015 07:41:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDubF-0004f4-3Y for qemu-devel@nongnu.org; Wed, 21 Jan 2015 07:41:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDubB-00085O-TY for qemu-devel@nongnu.org; Wed, 21 Jan 2015 07:41:33 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:58836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDubB-00085E-JP for qemu-devel@nongnu.org; Wed, 21 Jan 2015 07:41:29 -0500 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Jan 2015 12:41:28 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 21 Jan 2015 12:41:25 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id B45551B08069 for ; Wed, 21 Jan 2015 12:41:26 +0000 (GMT) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t0LCfPri55181422 for ; Wed, 21 Jan 2015 12:41:25 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t0LCfOk4028837 for ; Wed, 21 Jan 2015 05:41:25 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t0LCfOrN028810; Wed, 21 Jan 2015 05:41:24 -0700 From: Frank Blaschka To: cornelia.huck@de.ibm.com, borntraeger@de.ibm.com Date: Wed, 21 Jan 2015 13:41:22 +0100 Message-Id: <1421844082-59357-1-git-send-email-blaschka@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.4 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15012112-0041-0000-0000-000002F2624D X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.106 Cc: Frank Blaschka , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] s390x/pci: avoid sign extension in stpcifc X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org this patch avoids sign extension and fixes a data conversion bug in stpcifc. Both issues where found by Coverity. Signed-off-by: Frank Blaschka --- hw/s390x/s390-pci-inst.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 5ea13e5..4d4015c 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -785,9 +785,9 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba) stq_p(&fib.fmb_addr, pbdev->fmb_addr); data = (pbdev->isc << 28) | (pbdev->noi << 16) | - (pbdev->routes.adapter.ind_offset << 8) | (pbdev->sum << 7) | - pbdev->routes.adapter.summary_offset; - stw_p(&fib.data, data); + ((uint32_t)pbdev->routes.adapter.ind_offset << 8) | + (pbdev->sum << 7) | pbdev->routes.adapter.summary_offset; + stl_p(&fib.data, data); if (pbdev->fh >> ENABLE_BIT_OFFSET) { fib.fc |= 0x80;