Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp864633pxb; Thu, 21 Oct 2021 10:56:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1hQWauGbC0dSPzW1A9UlSjCWTstBK73+8nhrB6HcMSxejK/BSJnTfY7c0JuJcDfZUT1ti X-Received: by 2002:aa7:cd8b:: with SMTP id x11mr9698522edv.384.1634838973508; Thu, 21 Oct 2021 10:56:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634838973; cv=none; d=google.com; s=arc-20160816; b=Jwel9B96D+d0BN3hxD5+ezmCpDsQlfPOdku0BwG36rdm1GOfa0w2It2fbyIp/v7oN8 letYsetFAKJ0MQQ7FOr4EKexJckNAGKPJIwQRjluaVqEjKQI7Mi0ojpgEYHAo/euIOW/ rjO2wSZWTcTZQ5TQYye41g7Ny7ZhGHMtmDMnZpZ1lIyYQkxt5qOTc+/+iMzr8XHR5QHX N4fRJF0C9FTYD95EMLd82tAy1TWWlNXeb9GY0WaPE3YNwgVrBxwG/5BiGirRcGfyAc49 y/8uTBoqYBHDH5bD9qNb+PmkPpl6Fa2+ou8ABC3S4GnBnVWGHM01jmj63hj64Q9Wdgea xWsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=BSUIDgpzpqsYVy+UsL6p5KgT+iXdUFl7ePAjLERRehc=; b=BouHztvDZOHVZVwrMHNwoq5NKpGOGB27Mbqu23Tnvc7onp3ObK4StjfbdMJ/ZGZC5n d1GCUSVZ6EHHmjxRRpHx3eTbkCnQM5ETKz8e+mv7L/bblgYRe2D0nDeUm3xKIeC9vlF/ yAvbAt00tFD+/zXwnVSvQxUUC6tTm8jrX0VQvWY0I9Hfdq1ZfPG+RVI9e03iFs7c3JWS 3xVvH3GoS+ASaS2MhEcFCyVxwfCDqRpBJQEG5ztNytzRBSdKSpqndRad7VTcyJFV+G6m tU7F97OVENHDSgUXAcPCKc5hqkIS/ctkrYsFfJY48ft3LqpffuoCMCUMhoRU+0wa69i3 nofw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=aYWRc3Oa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i25si8644046ejd.303.2021.10.21.10.55.43; Thu, 21 Oct 2021 10:56:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=aYWRc3Oa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232262AbhJURzz (ORCPT + 99 others); Thu, 21 Oct 2021 13:55:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231727AbhJURzx (ORCPT ); Thu, 21 Oct 2021 13:55:53 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 690ACC0613B9 for ; Thu, 21 Oct 2021 10:53:37 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id o184so2087234iof.6 for ; Thu, 21 Oct 2021 10:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BSUIDgpzpqsYVy+UsL6p5KgT+iXdUFl7ePAjLERRehc=; b=aYWRc3OaRlQvlr1ibHgtUDDZ4eO6sny6EhdR3s1sJLjGQx1BFDxg39mac7wS4hYZDy xuFYQa2tbl8CfiLlrgVXjiQAQHpyYU/B3UWDvqBAygxD19OV/mtpsbB4KVVCAuLh2+9J nhINpHVoUHpGlIrbDXHY86emqTueCjqMgGjsI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BSUIDgpzpqsYVy+UsL6p5KgT+iXdUFl7ePAjLERRehc=; b=7mN0PLZo0WrA+HZqgjSOC778PsZF/uGhD6LP2efNEy3J73Pdew6Q+A/2A+IgSfRYhu Ig/62sawMFiG7cnb92stjfoX9LWEIsxd3YQHt6+p7uWiQHm9/0Lm5tgBl3sBm2l2BwPE U9eS7sU1ktD/acKWKzLAhfij/S0VOSrDK5BXg/5B5/cnwcGHb87zEQmzAv4lNsMLdpfs zn+ncXXyoiBzM+6sALZ/Gpr2SZFNYeQUV+1XZQYbT2CwHI6+Y60WU2R9VITUY5kSU9g4 rKVtRM2XPTyDYXnd+1u0lg7H8QZJcdC62G+1fB8TnGTjhGFgnPUSbOGzzhF8EsgfFCdN q1DA== X-Gm-Message-State: AOAM530Mx5Ib8XLO96xGXvI+J8KbV/aHLgMAAw4XAd9ABTYpEXV3/Jx8 0PY7R9Yq9uyLsOQlJeilsFT8ng== X-Received: by 2002:a05:6638:293:: with SMTP id c19mr4889841jaq.21.1634838816816; Thu, 21 Oct 2021 10:53:36 -0700 (PDT) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id s6sm3252573ilv.18.2021.10.21.10.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 10:53:36 -0700 (PDT) From: Shuah Khan To: pbonzini@redhat.com, shuah@kernel.org Cc: Shuah Khan , kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] selftests: kvm: fix mismatched fclose() after popen() Date: Thu, 21 Oct 2021 11:53:34 -0600 Message-Id: <20211021175335.22241-1-skhan@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org get_warnings_count() foes fclose() using File * returned from popen(). Fix it to call pclose() as it should. tools/testing/selftests/kvm/x86_64/mmio_warning_test x86_64/mmio_warning_test.c: In function ‘get_warnings_count’: x86_64/mmio_warning_test.c:87:9: warning: ‘fclose’ called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc] 87 | fclose(f); | ^~~~~~~~~ x86_64/mmio_warning_test.c:84:13: note: returned from ‘popen’ 84 | f = popen("dmesg | grep \"WARNING:\" | wc -l", "r"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Shuah Khan --- tools/testing/selftests/kvm/x86_64/mmio_warning_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c index 8039e1eff938..9f55ccd169a1 100644 --- a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c +++ b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c @@ -84,7 +84,7 @@ int get_warnings_count(void) f = popen("dmesg | grep \"WARNING:\" | wc -l", "r"); if (fscanf(f, "%d", &warnings) < 1) warnings = 0; - fclose(f); + pclose(f); return warnings; } -- 2.32.0