From mboxrd@z Thu Jan 1 00:00:00 1970 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=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 B7B24C55ABD for ; Sun, 15 Nov 2020 22:41:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5BB9F22314 for ; Sun, 15 Nov 2020 22:41:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="izupUJ0e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BB9F22314 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1keQhq-0004eC-CB for qemu-devel@archiver.kernel.org; Sun, 15 Nov 2020 17:41:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keQY7-00059X-Ub for qemu-devel@nongnu.org; Sun, 15 Nov 2020 17:31:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:57114) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1keQY5-00022d-5n for qemu-devel@nongnu.org; Sun, 15 Nov 2020 17:31:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605479464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eTDyF8qZ/+kyOvEMv/zkAMXekpV6mWj/zaDDozu+j7g=; b=izupUJ0eVDgfSzTz6WNKbsOYMuJI7uFzhBFOkRrUlCeIZiGjzR8shND9KfPA8rlNxqsjoe rG0PvnNYg/lrmu/qPp/njFjQaM+x8S5lxxSbfVCTXS2osuaqq/qo2HWfuUwcsb7i+Su2ZH PfS34mKqnkI0+wVCC3BGzW9QSUK+jSE= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-516-ulJksqMvOI6qhboLzqSv0A-1; Sun, 15 Nov 2020 17:28:00 -0500 X-MC-Unique: ulJksqMvOI6qhboLzqSv0A-1 Received: by mail-wm1-f71.google.com with SMTP id u123so7774768wmu.5 for ; Sun, 15 Nov 2020 14:28:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eTDyF8qZ/+kyOvEMv/zkAMXekpV6mWj/zaDDozu+j7g=; b=Bok6WUOL54xNeABaM029s9940ydSXOLOgEAQx1PypLG9JavKTHlbPYTZ37SdTRUs8I gunwOCNznQ8BFQdBZnG7cMtiZ7GrZtAHUs3LoVNXem97EcXDtJeREQs4B2TVGpMezgjX ASoi9yOB+OrgzcF4XRRjMZJT3P5CgWbIgKTez0kzT3OBGdkhTXPR7iuT29o33qmBeeSs z3rh/Mspg0Rq6ghTsKzNUEHnnXvq4fG5VycnorKpOTITn0PL08T3HeqxGApcKpUuQIOg rHzM+iTdWRbIM6g5uLL1BMQDpxuzcEIuxRxnJBlI7r8Z8bCP24LrT/KK1w3yLCVDicEE tH8Q== X-Gm-Message-State: AOAM532f/IOGakrlQSyHUuXFe4SeDWu1EPepb9mOeY6qYkb7ieoRxyzK hqSms2NCkszx9AJMqsw1FDhypX2gcDON4u5Pq8R4MwsyacZc4qGfvKrTu61c2wk/9Vk02gDuvsB ZJEnrrf1WfalGD4aGBNVdOZVet+MIuH/hLmJ3llI3CxfVxzovGP3BZVKcIGtq X-Received: by 2002:adf:f906:: with SMTP id b6mr15874155wrr.244.1605479278715; Sun, 15 Nov 2020 14:27:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHBgrC1JX1YB6mBve5qxMgW1rryENpjvFcfCa5Ef0WRz5jjZZPEmw5NtVaPaUD72Z8VrSoGg== X-Received: by 2002:adf:f906:: with SMTP id b6mr15874140wrr.244.1605479278531; Sun, 15 Nov 2020 14:27:58 -0800 (PST) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id i11sm20553636wro.85.2020.11.15.14.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 14:27:57 -0800 (PST) Date: Sun, 15 Nov 2020 17:27:56 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 17/17] vhost-user-blk/scsi: Fix broken error handling for socket call Message-ID: <20201115220740.488850-18-mst@redhat.com> References: <20201115220740.488850-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201115220740.488850-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/15 17:27:15 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: AlexChen , Peter Maydell , Raphael Norwitz , Euler Robot Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: AlexChen When socket() fails, it returns -1, 0 is the normal return value and should not return error. Reported-by: Euler Robot Signed-off-by: AlexChen Message-Id: <5F9A5B48.9030509@huawei.com> Reviewed-by: Raphael Norwitz Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- 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 caad88637e..dc981bf945 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -476,7 +476,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; } -- MST