Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3000188ybi; Mon, 17 Jun 2019 14:23:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsh0oZ98bojNRTsZZR+Pimv3XM0+rqDxfjqp4WLbi6fsQkvA4S4yWRbfscP7yqIfVzqSeT X-Received: by 2002:a17:90a:aa85:: with SMTP id l5mr1073529pjq.69.1560806609441; Mon, 17 Jun 2019 14:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560806609; cv=none; d=google.com; s=arc-20160816; b=0frfv4pyEMqwtilJvWRCvTqf1sbU9gh/2HbEI4upM8lsC+UWshgAOvO+i42FUnOHz0 ThvzjM/CUyvJffkhHXg+60Oza3ReSZoGtmyIzAZTvH5itEF3PsjASS3FI7rhY9P9rB8r xzaEqJdkMCa7LVCLaT6YQj5NHem81FM+B2A1TSlScExxtC197v2kn8nmjywQ8U1wYgqr s+x9UfxQC89xGls9nqZFkaDHze0UVoD+X7T2hKBorOd/VZA8QZ9pLoB1dg/st2459bf7 tYJkHb++IK/xEsnvbWvY3wghKv1dUSMQoE4xWygOWdPHw+u4wEr0nED++7Nyh22ILNId zxEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ey8qsy7Hl7mHdGpLNAe5s1IExmdCUy1SUtJYRdMoXz8=; b=WYKykuTabZjaS9AMtv32OsIa9hJTd7o/gRFierNUOaEmFTok3eqi/VO+Yte5Rr00Dk EIvICJ9hiGZ9hZS3I4msdP5ODAR03uYwGnWXdXCuCsehVFWejmijqQ78E3ObV8skVwGd d28ipGEuGj4DVqIZTMZJQvIaE/0W+BEhlg5wWHt6I3EoBM72g/eounrBcBdq8R3OTIMt eucQJhMDNy0ijqh3gGDAcF6B7T7Q9u9BbqS0d4ExCzG5+fEVxPaOZW8cIx1KLb7jl8zf oCj8AsSkjGJOZBrW/P6fnyrVQ3igW35hg/b6AHKcwzuNghLzNsLbumq3e4Ia+s4c6+Oz gZDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jxWu7WK6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c18si10938159plo.316.2019.06.17.14.23.14; Mon, 17 Jun 2019 14:23:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jxWu7WK6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729545AbfFQVW1 (ORCPT + 99 others); Mon, 17 Jun 2019 17:22:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:46914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726121AbfFQVWU (ORCPT ); Mon, 17 Jun 2019 17:22:20 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 440EA208E4; Mon, 17 Jun 2019 21:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806539; bh=UId77BICZEpA/UsvGVGQRGAbedVI4rYAgNUJ5+/5NQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jxWu7WK61k0oqYoDw7cz04cRe+YaopyWVl1acL37jz8EISVP80/4zYMXzugRtM4vh ckezjaZmzIGWCopUrvKTNTZkV+gAVjDSBIIpyj+RvDwVPzQSCI27LQCizw3LgNNzXa V7O7iWaVYxKIpgQPANhtZxQTpNiTas9ZAklSTUTY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Vitaly Kuznetsov , Thomas Huth , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.1 085/115] KVM: selftests: Fix a condition in test_hv_cpuid() Date: Mon, 17 Jun 2019 23:09:45 +0200 Message-Id: <20190617210804.324541692@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190617210759.929316339@linuxfoundation.org> References: <20190617210759.929316339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit be7fcf1d1701a5266dd36eab4978476f63d1bd57 ] The code is trying to check that all the padding is zeroed out and it does this: entry->padding[0] == entry->padding[1] == entry->padding[2] == 0 Assume everything is zeroed correctly, then the first comparison is true, the next comparison is false and false is equal to zero so the overall condition is true. This bug doesn't affect run time very badly, but the code should instead just check that all three paddings are zero individually. Also the error message was copy and pasted from an earlier error and it wasn't correct. Fixes: 7edcb7343327 ("KVM: selftests: Add hyperv_cpuid test") Signed-off-by: Dan Carpenter Reviewed-by: Vitaly Kuznetsov Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c b/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c index 9a21e912097c..63b9fc3fdfbe 100644 --- a/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c +++ b/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c @@ -58,9 +58,8 @@ static void test_hv_cpuid(struct kvm_cpuid2 *hv_cpuid_entries, TEST_ASSERT(entry->flags == 0, ".flags field should be zero"); - TEST_ASSERT(entry->padding[0] == entry->padding[1] - == entry->padding[2] == 0, - ".index field should be zero"); + TEST_ASSERT(!entry->padding[0] && !entry->padding[1] && + !entry->padding[2], "padding should be zero"); /* * If needed for debug: -- 2.20.1