From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Shuah Khan <skhan@linuxfoundation.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Sasha Levin <sashal@kernel.org>,
shuah@kernel.org, kvm@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 09/11] selftests:kvm: fix get_warnings_count() ignoring fscanf() return warn
Date: Tue, 28 Sep 2021 01:57:02 -0400 [thread overview]
Message-ID: <20210928055704.172814-9-sashal@kernel.org> (raw)
In-Reply-To: <20210928055704.172814-1-sashal@kernel.org>
From: Shuah Khan <skhan@linuxfoundation.org>
[ Upstream commit 39a71f712d8a13728febd8f3cb3f6db7e1fa7221 ]
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 <skhan@linuxfoundation.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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 00bb97d76000..2cbc09aad7f6 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;
--
2.33.0
next prev parent reply other threads:[~2021-09-28 6:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 5:56 [PATCH AUTOSEL 5.4 01/11] net: mdio: introduce a shutdown method to mdio device drivers Sasha Levin
2021-09-28 5:56 ` [PATCH AUTOSEL 5.4 02/11] xen-netback: correct success/error reporting for the SKB-with-fraglist case Sasha Levin
2021-09-28 5:56 ` [PATCH AUTOSEL 5.4 03/11] sparc64: fix pci_iounmap() when CONFIG_PCI is not set Sasha Levin
2021-09-28 5:56 ` [PATCH AUTOSEL 5.4 04/11] ext2: fix sleeping in atomic bugs on error Sasha Levin
2021-09-28 5:56 ` [PATCH AUTOSEL 5.4 05/11] scsi: sd: Free scsi_disk device via put_device() Sasha Levin
2021-09-28 5:56 ` [PATCH AUTOSEL 5.4 06/11] usb: testusb: Fix for showing the connection speed Sasha Levin
2021-09-28 5:57 ` [PATCH AUTOSEL 5.4 07/11] usb: dwc2: check return value after calling platform_get_resource() Sasha Levin
2021-09-28 5:57 ` [PATCH AUTOSEL 5.4 08/11] selftests: be sure to make khdr before other targets Sasha Levin
2021-09-28 5:57 ` Sasha Levin [this message]
2021-09-28 5:57 ` [PATCH AUTOSEL 5.4 10/11] scsi: ses: Retry failed Send/Receive Diagnostic commands Sasha Levin
2021-09-28 5:57 ` [PATCH AUTOSEL 5.4 11/11] tools/vm/page-types: remove dependency on opt_file for idle page tracking Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210928055704.172814-9-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox