Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp866843pxb; Thu, 21 Oct 2021 10:58:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSUZ0YD9Fzm9GnhRvgHK9zDWDgg4rYTJ2cBywZGHzC0OJsdxVWV23rtO/9lQHj3PuOWJdp X-Received: by 2002:aa7:d9c2:: with SMTP id v2mr9373881eds.72.1634839138956; Thu, 21 Oct 2021 10:58:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634839138; cv=none; d=google.com; s=arc-20160816; b=Mx8AheY/OJ3m97dtB44nMEqIzsTOzZnEGVKRbpWpX530OOSxGxJMj0Hy9jUKYvg9qY fG4hjnxVXds77bZT6US8CnUUFNE95f0HIvwfveHwZ9VQnCc8bY0iYwvfAFr0xqxL116N 8JMr+VwdGWmqouavPFdc5NMTrx9joGnUKyK1Qou1yeWTTqj2JwAXOfSYwOJq0Fj+tu7h QZTuhY09Xpnirv7UJrgEX5AykPtaCDFCyARWKDRMbB7BUNLWiseJDMwBiidm1lY8xYHy dStNWYpExlYGobA7w30n4ggF6o5IAQFQFtwbHQlGSa3xDslBl8qcLkyp5AN5D55EPyek DUqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=2LtkF/468p93Y4YoTGIHUn5Ubw3qEnn8ZhP9111mEls=; b=YB4986uc1Za0S9JcPssqSXAEnU0hCgYEwcO8Tll6TFCw9jOwSk+WyGOz0tmYhAPxzZ llgWwvtR18JGfynkfKOaHBdZnYY4dMIUFcAevjt37A8XFOJKhiDg7qh3ddklk+koESUV YYY1G2K8PXzllz3OLGq72YLiUPQHIxowOH/X9KpAuGc743PwGuTBbh2rvl1A6zU5P8aa sFPIPEhsPxMttVPP+cHT0H3gK2vm5ZT1KNSqfkiSzugSVdKEXKGzim7fPT3JkMS3qQp4 7/rwT0nUzFyscg1AQI50Lubf65R2q8O8NQDg0dVqUrJTb47aBcuWp0u92/6+4m6CmIJz ce4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b="X/JmnOR/"; 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 r2si7995087eja.442.2021.10.21.10.58.34; Thu, 21 Oct 2021 10:58:58 -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="X/JmnOR/"; 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 S231921AbhJUR5r (ORCPT + 99 others); Thu, 21 Oct 2021 13:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232279AbhJUR5q (ORCPT ); Thu, 21 Oct 2021 13:57:46 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1B9EC0613B9 for ; Thu, 21 Oct 2021 10:55:30 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id y67so2063766iof.10 for ; Thu, 21 Oct 2021 10:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=2LtkF/468p93Y4YoTGIHUn5Ubw3qEnn8ZhP9111mEls=; b=X/JmnOR/qbdUlbj2jQFETd5boe5ncFPn05fdeq4gJ5mtxo14/HKHAjG2nJUb/nLG3P irihOf2cNrOT93p2TbTfrGdyu9G2GFbmlfTMRYlo7oy2jU4MVqE4oS4ZJs6BkaU7G0ok UkjkEoI8Wi6Gjw6p3N8H0JUeDE+aCJ2cQch0E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2LtkF/468p93Y4YoTGIHUn5Ubw3qEnn8ZhP9111mEls=; b=odQ2TT+E2/0E65cFrW00lnXl1Ow6m0rB2E7FFF0ieQE3Kd3Ick1XJFwz/B2rjF4ZAy WHw/dxRBYoZbyl3xywPtGnmrKcncr8ifycIGJMLgD3sOZhF+7IfgIliFqSfby5XByslS bgrPTLnKoav1KqXdi4q0WR3fDz9mE5URKnX3aEZC1ieFOwqSXll9PgEWzLi0kV5t7KgR 1Zyf+BzSEttAKFch8MSGL/qyu4k0vQq94Biol8FtDsAdY19uqPcaHdLQBtplZ0j2xXW/ B2Ii9nYHjBcyd0RBlo6EcGN0M4e7Bhb47bbLiv+Qo50R1Eyqr0UKPMxMGx2w+C47QCJ3 bAMA== X-Gm-Message-State: AOAM530w0Xb5/rbp+GUrJHEaYJIX6X6lnO6n/L49oKdSgbiQTFMMiCeu rwDzJQTwhM7PE5rWLhxV5wysuw== X-Received: by 2002:a05:6602:2d81:: with SMTP id k1mr5077114iow.87.1634838930227; Thu, 21 Oct 2021 10:55:30 -0700 (PDT) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id c5sm3018346ilq.71.2021.10.21.10.55.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Oct 2021 10:55:29 -0700 (PDT) Subject: Re: [PATCH] selftests: kvm: fix mismatched fclose() after popen() To: pbonzini@redhat.com, shuah@kernel.org Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <20211021175335.22241-1-skhan@linuxfoundation.org> From: Shuah Khan Message-ID: <407e0a02-f7c3-f429-6e7d-3a60a14e09fa@linuxfoundation.org> Date: Thu, 21 Oct 2021 11:55:29 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20211021175335.22241-1-skhan@linuxfoundation.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/21/21 11:53 AM, Shuah Khan wrote: > get_warnings_count() foes fclose() using File * returned from popen(). Oops should have been "does". Sending v2 with that change now. > 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; > } > thanks, -- Shuah