From: Xie Yongji <xieyongji@bytedance.com>
To: kwolf@redhat.com, stefanha@redhat.com, armbru@redhat.com
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH 3/4] libvduse: Pass positive value to strerror()
Date: Mon, 27 Jun 2022 17:02:02 +0800 [thread overview]
Message-ID: <20220627090203.87-4-xieyongji@bytedance.com> (raw)
In-Reply-To: <20220627090203.87-1-xieyongji@bytedance.com>
The value passed to strerror() should be positive.
So let's fix it.
Fixes: Coverity CID 1490226, 1490223
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
---
subprojects/libvduse/libvduse.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.c
index 1e36227388..1a5981445c 100644
--- a/subprojects/libvduse/libvduse.c
+++ b/subprojects/libvduse/libvduse.c
@@ -1257,7 +1257,7 @@ VduseDev *vduse_dev_create_by_name(const char *name, uint16_t num_queues,
ret = vduse_dev_init(dev, name, num_queues, ops, priv);
if (ret < 0) {
fprintf(stderr, "Failed to init vduse device %s: %s\n",
- name, strerror(ret));
+ name, strerror(-ret));
free(dev);
return NULL;
}
@@ -1331,7 +1331,7 @@ VduseDev *vduse_dev_create(const char *name, uint32_t device_id,
ret = vduse_dev_init(dev, name, num_queues, ops, priv);
if (ret < 0) {
fprintf(stderr, "Failed to init vduse device %s: %s\n",
- name, strerror(ret));
+ name, strerror(-ret));
goto err;
}
--
2.20.1
next prev parent reply other threads:[~2022-06-27 9:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 9:01 [PATCH 0/4] Fix some coverity issues on VDUSE Xie Yongji
2022-06-27 9:02 ` [PATCH 1/4] libvduse: Fix the incorrect function name Xie Yongji
2022-06-29 9:37 ` Markus Armbruster
2022-06-27 9:02 ` [PATCH 2/4] libvduse: Replace strcpy() with strncpy() Xie Yongji
2022-06-28 0:25 ` Richard Henderson
2022-06-28 2:59 ` Yongji Xie
2022-06-29 9:38 ` Markus Armbruster
2022-06-27 9:02 ` Xie Yongji [this message]
2022-06-28 0:26 ` [PATCH 3/4] libvduse: Pass positive value to strerror() Richard Henderson
2022-06-29 9:38 ` Markus Armbruster
2022-06-27 9:02 ` [PATCH 4/4] libvduse: Check the return value of some ioctls Xie Yongji
2022-06-29 9:41 ` Markus Armbruster
2022-06-29 11:10 ` Yongji Xie
2022-06-29 11:39 ` Markus Armbruster
2022-06-29 12:37 ` Yongji Xie
2022-06-29 13:22 ` Markus Armbruster
2022-06-29 13:28 ` Yongji Xie
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=20220627090203.87-4-xieyongji@bytedance.com \
--to=xieyongji@bytedance.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).