From patchwork Mon Oct 30 02:56:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10031937 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 20258600C5 for ; Mon, 30 Oct 2017 03:14:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E0342018E for ; Mon, 30 Oct 2017 03:14:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02E4F28675; Mon, 30 Oct 2017 03:14:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B1BF42018E for ; Mon, 30 Oct 2017 03:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=FHhdAeY16GA6v6RDvO27HQ705I13JWhBCokQmKwKFEU=; b=KMOM6/u0SZe88ZzUcZV8hVuTVl J2So4YUocehobrJMXwEFSfpHlT8vd4zskbn/XP8+y1CgHKYW+mlIRgGQJPLdsKGHhcOMQb35UuRUe 3rHqQFoq+bIzm9IhNPIL2AmyV9o72EouwQfsYM2IsSOf6xiasMDbXZHgS/05NjFRdSj5FM8Ajdo1h mIB/zTX2or03UOX1rXdAOSswSoHc3hdrlYj8P5foA/Ks8L+l2UKkGIkMMfFCwp7GiNmdF/RndKyij mke5VFH53GyPji++cZ7x70snQ3FoOoUvTW2Eh9T1LOlsyBdYu8gWc1L5Vz1eLdU8vEnMxTifqu0vx uUSGRAAA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e90XK-0005u4-Hf; Mon, 30 Oct 2017 03:14:50 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e90Fi-00060Q-T0 for linux-arm-kernel@lists.infradead.org; Mon, 30 Oct 2017 02:56:46 +0000 Received: by mail-wm0-x241.google.com with SMTP id y80so6109747wmd.0 for ; Sun, 29 Oct 2017 19:56:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5Npenw+7w9XghqsuNnJu7GP12VeeQrUdZ7a9Mz4Jwdw=; b=adCZszhR1qLz5EqJNk8hU9Ijx7Pw9BtjffgEmLzJigf2hiHl3egLY3KA/QEzf03Yg4 giRP07HpnZvneYs7+R9iWzoc1EkGJyM957CRcG2gDOjmV5yPcVsgYwq6ltpMbVaqyrY1 m95t6CvcHLx+0fw+dNCpseq70BgvWBYC2hLq0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5Npenw+7w9XghqsuNnJu7GP12VeeQrUdZ7a9Mz4Jwdw=; b=m4sQAn+7RpLzIAyjxzW8SUhzux7YlpaC7/k6mm3uAxWdcoSrS2Y24wL+cQulqJvj6b NTdkg6omZniJF12KDlJnkyiAt3S3jUeJYv4g+ULoWs4+hv2QGmp+0Ll0nxGOh9xdp6l4 SWIt6oOdokbIH1kOPXpItSVmW5G1TWLJZcafxrKBRtFjp9qoISXl6L9mDd9XxPhF3RDo IQxK5iQqyKLcWYZjjHncssRyx4jOpI7YMnAJ5mCyrK1gbbkwnEa/t4Ng3VCe8y6Db1aT kET3W87f41zQ4nZkwggUpitAdNNFB64o3Q+yK4lQQA2RlesauiIHcMcmVBx+rte5pa41 n56g== X-Gm-Message-State: AMCzsaWHA4U1mCubStLTvFRihSOEZRstUZAeUXiEEudAGyjEa4b4boIj EXi7DMUuVLEAisrn9b6u98swww== X-Google-Smtp-Source: ABhQp+SV8DUe8vsggTGwWigzMEoU7hzwjV3/S/C2erga61g2NqlzJR3z4B6vQgHowI39OaCv3Fkb+g== X-Received: by 10.80.218.202 with SMTP id s10mr10072678edj.212.1509332177211; Sun, 29 Oct 2017 19:56:17 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id u14sm7856415edd.47.2017.10.29.19.56.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Oct 2017 19:56:16 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 6/8] KVM: arm/arm64: vgic-its: Fix vgic_its_restore_collection_table returned value Date: Mon, 30 Oct 2017 03:56:01 +0100 Message-Id: <20171030025603.23550-7-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171030025603.23550-1-christoffer.dall@linaro.org> References: <20171030025603.23550-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171029_195639_473362_2F298F76 X-CRM114-Status: UNSURE ( 9.88 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Marc Zyngier , Eric Auger , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, Christoffer Dall MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Auger vgic_its_restore_cte returns +1 if the collection table entry is valid and properly decoded. As a consequence, if the collection table is fully filled with valid data that are decoded without error, vgic_its_restore_collection_table() returns +1. This is wrong. Let's return 0 in that case. Fixes: ea1ad53e1e31a3 (KVM: arm64: vgic-its: Collection table save/restore) Signed-off-by: Eric Auger Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-its.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index 76685f4c6261..6a715a6ec64e 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -2264,6 +2264,10 @@ static int vgic_its_restore_collection_table(struct vgic_its *its) gpa += cte_esz; read += cte_esz; } + + if (ret > 0) + return 0; + return ret; }