From patchwork Wed Sep 15 21:28:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12497513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76447C433FE for ; Wed, 15 Sep 2021 21:28:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5FEA760E8B for ; Wed, 15 Sep 2021 21:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232392AbhIOV3d (ORCPT ); Wed, 15 Sep 2021 17:29:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232356AbhIOV3c (ORCPT ); Wed, 15 Sep 2021 17:29:32 -0400 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03374C061764 for ; Wed, 15 Sep 2021 14:28:13 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id i13so4483896ilm.4 for ; Wed, 15 Sep 2021 14:28:12 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=5/05t+cft47v+XjdfjmqtyGwgO/Y9iAdxp4y0oub3sQ=; b=EM5CoyJnEhE01BEs479VfIK4jImJFA22maAiLWfX5Z5H5XLK6PeVPVtKY+6RzJT87g H2wcT9fOX9GB0dUitCiGG5KaaQ1Quna3ubgUKRq++A8LoyLlgRCHzrLG4Kr6Uzpa0s7/ a2HRzuRsOc5tj+nz+zso25WUH+s7WG+oOfKMg= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=5/05t+cft47v+XjdfjmqtyGwgO/Y9iAdxp4y0oub3sQ=; b=zyujyCHLFkMXo8HLN/KiQE8TuKZfRZGS3XcsVojmKBkwT9qRHauPa7OmCQBsR8nhxL yclCW3y6amT8YFX4SLqS7dV917PTg2CQLp7YWmM74VsQ33miXi2XlFPLVQsOxsjyg1LE Rw3cgCC3qPQYgG9LKlxxinQrmAaAmiMS85WC74UoZospqsSUPjE+njpFGsXQWkiJzDi4 i/MbpGrPcSqssDvEVFwI1SPMxP8H64I5x6pfBuK7WB2eOaYpAmgKlAWTkUzHLqETF+v3 n1KUOzcgdrHhn5mdDLDWtGGDuMR622q1eR4rPtJ7pzWQXLHAGDC7pdOvqjGOug1SNi2G AXHA== X-Gm-Message-State: AOAM533uzotVwa6vB0DcIPa7a0fAJJ6a6LVebwS5MxW5Xfx0r6aGrokB SKFBYWC/+huEZAUsdoVbjEC0yg== X-Google-Smtp-Source: ABdhPJzxwqX7gRE030Q48r8VOe+p/R3TO1zws/jz/AaNUPiJtQPKoSMaf/CgIE2QH4dRMm+QAjA+MQ== X-Received: by 2002:a92:bf0c:: with SMTP id z12mr1588379ilh.241.1631741292332; Wed, 15 Sep 2021 14:28:12 -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 f2sm622884ioz.14.2021.09.15.14.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 14:28:11 -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 1/4] selftests:kvm: fix get_warnings_count() ignoring fscanf() return warn Date: Wed, 15 Sep 2021 15:28:06 -0600 Message-Id: <9dfad43fb500a77f7a08e5e7b80dcb07172d6e44.1631737524.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Fix get_warnings_count() to check fscanf() return value to get rid of the following warning: x86_64/mmio_warning_test.c: In function ‘get_warnings_count’: x86_64/mmio_warning_test.c:85:2: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 85 | fscanf(f, "%d", &warnings); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Shuah Khan --- tools/testing/selftests/kvm/x86_64/mmio_warning_test.c | 3 ++- 1 file changed, 2 insertions(+), 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 e6480fd5c4bd..8039e1eff938 100644 --- a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c +++ b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c @@ -82,7 +82,8 @@ int get_warnings_count(void) FILE *f; f = popen("dmesg | grep \"WARNING:\" | wc -l", "r"); - fscanf(f, "%d", &warnings); + if (fscanf(f, "%d", &warnings) < 1) + warnings = 0; fclose(f); return warnings;