From: Greg Kurz <groug@kaod.org>
To: Christian Schoenebeck <qemu_oss@crudebyte.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] tests/9pfs: fix coverity error in create_local_test_dir()
Date: Fri, 30 Oct 2020 12:44:18 +0100 [thread overview]
Message-ID: <20201030124418.1a20fb9f@bahia.lan> (raw)
In-Reply-To: <b111895492f8fb79bcca1c3e9586c0615f46cc97.1604046404.git.qemu_oss@crudebyte.com>
On Fri, 30 Oct 2020 09:19:46 +0100
Christian Schoenebeck <qemu_oss@crudebyte.com> wrote:
> Coverity wants the return value of mkdir() to be checked, so let's
> pretend to do that. We're actually just making a dummy check and
> ignore the result, because we actually only care if the required
> directory exists and we have an existence check for that in place
> already.
>
I see that sometimes changelog shows a copy of the original
coverity report (e.g. commit df1a312fea58).
> Reported-by: Greg Kurz <groug@kaod.org>
Please give credits to coverity, not me :-)
And most importantly, we want to mention the CID in the changelog.
e.g.
Reported-by: Coverity (CID 1435963)
> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> ---
> tests/qtest/libqos/virtio-9p.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tests/qtest/libqos/virtio-9p.c b/tests/qtest/libqos/virtio-9p.c
> index 6b22fa0e9a..0a7c0ee5d8 100644
> --- a/tests/qtest/libqos/virtio-9p.c
> +++ b/tests/qtest/libqos/virtio-9p.c
> @@ -48,9 +48,13 @@ static void init_local_test_path(void)
> static void create_local_test_dir(void)
> {
> struct stat st;
> + int res;
>
> g_assert(local_test_path != NULL);
> - mkdir(local_test_path, 0777);
> + res = mkdir(local_test_path, 0777);
> + if (res < 0) {
> + /* ignore error, dummy check to prevent error by coverity */
Why not printing an error message with errno there like you did in
the previous patch ?
> + }
>
> /* ensure test directory exists now ... */
> g_assert(stat(local_test_path, &st) == 0);
next prev parent reply other threads:[~2020-10-30 11:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 8:26 [PATCH 0/2] 9pfs: test suite fixes Christian Schoenebeck
2020-10-30 8:19 ` [PATCH 1/2] tests/9pfs: fix test dir for parallel tests Christian Schoenebeck
2020-10-30 11:32 ` Greg Kurz
2020-11-09 11:51 ` Thomas Huth
2020-10-30 8:19 ` [PATCH 2/2] tests/9pfs: fix coverity error in create_local_test_dir() Christian Schoenebeck
2020-10-30 11:44 ` Greg Kurz [this message]
2020-10-30 11:59 ` Christian Schoenebeck
2020-10-30 12:09 ` Peter Maydell
2020-10-30 13:04 ` Christian Schoenebeck
2020-10-30 12:32 ` Greg Kurz
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=20201030124418.1a20fb9f@bahia.lan \
--to=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu_oss@crudebyte.com \
/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;
as well as URLs for NNTP newsgroup(s).