From: "Michael S. Tsirkin" <mst@redhat.com>
To: AlexChen <alex.chen@huawei.com>
Cc: Raphael Norwitz <raphael.s.norwitz@gmail.com>,
QEMU <qemu-devel@nongnu.org>,
qemu-trivial@nongnu.org
Subject: Re: [PATCH V2] vhost-user-blk/scsi: Fix broken error handling for socket call
Date: Sat, 14 Nov 2020 11:46:29 -0500 [thread overview]
Message-ID: <20201114114622-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <5F9A5B48.9030509@huawei.com>
On Thu, Oct 29, 2020 at 02:03:52PM +0800, AlexChen wrote:
> When socket() fails, it returns -1, 0 is the normal return value and should not return error.
>
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: AlexChen <alex.chen@huawei.com>
Tagged, thanks!
> ---
> contrib/vhost-user-blk/vhost-user-blk.c | 2 +-
> contrib/vhost-user-scsi/vhost-user-scsi.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c
> index 25eccd02b5..40a2dfc544 100644
> --- a/contrib/vhost-user-blk/vhost-user-blk.c
> +++ b/contrib/vhost-user-blk/vhost-user-blk.c
> @@ -474,7 +474,7 @@ static int unix_sock_new(char *unix_fn)
> assert(unix_fn);
>
> sock = socket(AF_UNIX, SOCK_STREAM, 0);
> - if (sock <= 0) {
> + if (sock < 0) {
> perror("socket");
> return -1;
> }
> diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c
> index 3c912384e9..0f9ba4b2a2 100644
> --- a/contrib/vhost-user-scsi/vhost-user-scsi.c
> +++ b/contrib/vhost-user-scsi/vhost-user-scsi.c
> @@ -320,7 +320,7 @@ static int unix_sock_new(char *unix_fn)
> assert(unix_fn);
>
> sock = socket(AF_UNIX, SOCK_STREAM, 0);
> - if (sock <= 0) {
> + if (sock < 0) {
> perror("socket");
> return -1;
> }
> --
> 2.19.1
>
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: AlexChen <alex.chen@huawei.com>
Cc: qemu-trivial@nongnu.org,
Raphael Norwitz <raphael.s.norwitz@gmail.com>,
QEMU <qemu-devel@nongnu.org>
Subject: Re: [PATCH V2] vhost-user-blk/scsi: Fix broken error handling for socket call
Date: Sat, 14 Nov 2020 11:46:29 -0500 [thread overview]
Message-ID: <20201114114622-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <5F9A5B48.9030509@huawei.com>
On Thu, Oct 29, 2020 at 02:03:52PM +0800, AlexChen wrote:
> When socket() fails, it returns -1, 0 is the normal return value and should not return error.
>
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: AlexChen <alex.chen@huawei.com>
Tagged, thanks!
> ---
> contrib/vhost-user-blk/vhost-user-blk.c | 2 +-
> contrib/vhost-user-scsi/vhost-user-scsi.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c
> index 25eccd02b5..40a2dfc544 100644
> --- a/contrib/vhost-user-blk/vhost-user-blk.c
> +++ b/contrib/vhost-user-blk/vhost-user-blk.c
> @@ -474,7 +474,7 @@ static int unix_sock_new(char *unix_fn)
> assert(unix_fn);
>
> sock = socket(AF_UNIX, SOCK_STREAM, 0);
> - if (sock <= 0) {
> + if (sock < 0) {
> perror("socket");
> return -1;
> }
> diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c
> index 3c912384e9..0f9ba4b2a2 100644
> --- a/contrib/vhost-user-scsi/vhost-user-scsi.c
> +++ b/contrib/vhost-user-scsi/vhost-user-scsi.c
> @@ -320,7 +320,7 @@ static int unix_sock_new(char *unix_fn)
> assert(unix_fn);
>
> sock = socket(AF_UNIX, SOCK_STREAM, 0);
> - if (sock <= 0) {
> + if (sock < 0) {
> perror("socket");
> return -1;
> }
> --
> 2.19.1
>
next prev parent reply other threads:[~2020-11-14 16:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-28 14:09 [PATCH] vhost-user-blk: Fix two resource leaks AlexChen
2020-10-28 14:09 ` AlexChen
2020-10-28 15:40 ` Raphael Norwitz
2020-10-28 15:40 ` Raphael Norwitz
2020-10-29 5:58 ` AlexChen
2020-10-29 5:58 ` AlexChen
2020-10-29 6:03 ` [PATCH V2] vhost-user-blk/scsi: Fix broken error handling for socket call AlexChen
2020-10-29 16:41 ` Raphael Norwitz
2020-10-29 16:41 ` Raphael Norwitz
2020-11-12 15:48 ` Peter Maydell
2020-11-12 15:48 ` Peter Maydell
2020-11-14 16:46 ` Michael S. Tsirkin [this message]
2020-11-14 16:46 ` Michael S. Tsirkin
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=20201114114622-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=alex.chen@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=raphael.s.norwitz@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.