From patchwork Mon Dec 8 14:58:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 42013 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C3B39244AC for ; Mon, 8 Dec 2014 14:59:10 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id u10sf2842150lbd.2 for ; Mon, 08 Dec 2014 06:59:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=3/sDi+lHJOtLZ67Ypns+y2bl3q6N9Tj3NDk28bh7Wig=; b=GU5wV8l02MF5pQGIXSrhS0HEPzwJ6vR2na6z4Ir7dTgSZ0fQbFb992GA3ABBsiMtQu da2jXr0W59QjQ4eLts6sCG6ZU94HIuqo5rQhwaJ7Knkdh9Xbp7FvpGZxGIUaXbwmUcVi OhyhhKa0nyyzLerLMAwWtpNefadxpvsOAijxFg9cq+QB2n3m6YVUOgYj/UtddSLMGod4 J3FweYRuOsaCeEktCh5YhGh0+EPCUVkyYI2DXAfDm23GKF9UVEx5CnQ5tkxSK36j/qyd SngELa+NNcYFgg6Co/RCJjsbqPug/wdA85ceg5jCrg3Hc/9kWUmO/Cy3xKv6EpL9yD9+ KReA== X-Gm-Message-State: ALoCoQkMCu2Bm1D6FiTCFdf8XPO1QmGElY155JG51Cz1ahc8af1ufXgvyQpgEWIEzXDVZGYsV7aj X-Received: by 10.152.8.67 with SMTP id p3mr488491laa.4.1418050749678; Mon, 08 Dec 2014 06:59:09 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.170 with SMTP id d10ls548892lad.37.gmail; Mon, 08 Dec 2014 06:59:09 -0800 (PST) X-Received: by 10.112.146.37 with SMTP id sz5mr16730623lbb.27.1418050749440; Mon, 08 Dec 2014 06:59:09 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id q2si17710969laj.9.2014.12.08.06.59.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Dec 2014 06:59:09 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id pv20so4065794lab.27 for ; Mon, 08 Dec 2014 06:59:09 -0800 (PST) X-Received: by 10.112.235.196 with SMTP id uo4mr16493008lbc.66.1418050749359; Mon, 08 Dec 2014 06:59:09 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp617354lbc; Mon, 8 Dec 2014 06:59:08 -0800 (PST) X-Received: by 10.140.80.136 with SMTP id c8mr50719979qgd.86.1418050747565; Mon, 08 Dec 2014 06:59:07 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id v1si43536288qad.74.2014.12.08.06.59.06 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 08 Dec 2014 06:59:07 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XxzmD-0006I9-2l; Mon, 08 Dec 2014 14:59:05 +0000 Received: from mail-lb0-f171.google.com ([209.85.217.171]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xxzlx-0006Gy-PT for lng-odp@lists.linaro.org; Mon, 08 Dec 2014 14:58:49 +0000 Received: by mail-lb0-f171.google.com with SMTP id n15so3911998lbi.16 for ; Mon, 08 Dec 2014 06:58:44 -0800 (PST) X-Received: by 10.112.101.100 with SMTP id ff4mr16457853lbb.94.1418050724180; Mon, 08 Dec 2014 06:58:44 -0800 (PST) Received: from localhost.localdomain ([188.92.105.210]) by mx.google.com with ESMTPSA id xs6sm10869631lbb.13.2014.12.08.06.58.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Dec 2014 06:58:43 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 8 Dec 2014 17:58:28 +0300 Message-Id: <1418050713-29694-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1418050713-29694-1-git-send-email-maxim.uvarov@linaro.org> References: <1418050713-29694-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv7 1/6] linux-generic: set not initialized socket to -1 X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 In case of stdin is not attached socket() can return 0 for valid socket fd. Not initialized socket has to be -1. Signed-off-by: Maxim Uvarov --- platform/linux-generic/odp_packet_io.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 706a3cc..faa197f 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -114,6 +114,9 @@ static void init_pktio_entry(pktio_entry_t *entry) entry->s.inq_default = ODP_QUEUE_INVALID; memset(&entry->s.pkt_sock, 0, sizeof(entry->s.pkt_sock)); memset(&entry->s.pkt_sock_mmap, 0, sizeof(entry->s.pkt_sock_mmap)); + /* set sockfd to -1, because a valid socked might be initialized to 0 */ + entry->s.pkt_sock.sockfd = -1; + entry->s.pkt_sock_mmap.sockfd = -1; } static odp_pktio_t alloc_lock_pktio_entry(void)