From patchwork Fri Dec 5 16:20:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 41978 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E4BBB240F7 for ; Fri, 5 Dec 2014 16:20:59 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id c13sf723330eek.6 for ; Fri, 05 Dec 2014 08:20:59 -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=ClXKx6/o3I/iT9lU2V9T+9/0B84HewwrwWYeJyIEV9a1bKnFepaQmaoDjJUOFbUWxf u1Im0IOEkJZru4SApJPRAn8CAViape6Oiy0S6U8KFAzj6dWp0t/S0Q0IhtamPRiPx5kP 4Tbf/pW0Xs0f5yinJB4blM4Btvgc0/3wfEgAqMANEgujKRxWvl7mDsJSUsmTmMvNPgLX uQI6EGyg0jkA63CTQLpw9LvXVwSTX5eomHRPTiY8P4UF3+rTjvzKbvo0WpmuPatf5uZW 63iCH2L2Z7mzH9BzPDWB1xZ30VMNXUO3ekmyBWssBi7ybjVzoEeiUTvO51OzG4EH6F+0 K3Rg== X-Gm-Message-State: ALoCoQkNyzKUDMyM42bhtZ8qDW4EFm+ICfKXQlibcDJRraYgw647ywZPCjTZplzgBikDTNsjj2UL X-Received: by 10.112.138.234 with SMTP id qt10mr3644420lbb.4.1417796459050; Fri, 05 Dec 2014 08:20:59 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.227 with SMTP id ap3ls417985lac.60.gmail; Fri, 05 Dec 2014 08:20:58 -0800 (PST) X-Received: by 10.112.144.228 with SMTP id sp4mr3632305lbb.58.1417796458645; Fri, 05 Dec 2014 08:20:58 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id sf5si29381711lbb.46.2014.12.05.08.20.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Dec 2014 08:20:58 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id f15so879765lbj.37 for ; Fri, 05 Dec 2014 08:20:58 -0800 (PST) X-Received: by 10.152.43.12 with SMTP id s12mr3574835lal.67.1417796458564; Fri, 05 Dec 2014 08:20:58 -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 ew9csp239385lbc; Fri, 5 Dec 2014 08:20:57 -0800 (PST) X-Received: by 10.140.107.37 with SMTP id g34mr26690855qgf.38.1417796457197; Fri, 05 Dec 2014 08:20:57 -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 z63si35284614qgd.46.2014.12.05.08.20.56 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 05 Dec 2014 08:20:57 -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 1Xwvck-0001v8-8T; Fri, 05 Dec 2014 16:20:54 +0000 Received: from mail-la0-f41.google.com ([209.85.215.41]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XwvcV-0001rY-CM for lng-odp@lists.linaro.org; Fri, 05 Dec 2014 16:20:39 +0000 Received: by mail-la0-f41.google.com with SMTP id hv19so944650lab.28 for ; Fri, 05 Dec 2014 08:20:33 -0800 (PST) X-Received: by 10.152.22.199 with SMTP id g7mr3694489laf.23.1417796433537; Fri, 05 Dec 2014 08:20:33 -0800 (PST) Received: from localhost.localdomain (ppp91-76-163-205.pppoe.mtu-net.ru. [91.76.163.205]) by mx.google.com with ESMTPSA id pr9sm8455263lbc.12.2014.12.05.08.20.32 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Dec 2014 08:20:32 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 5 Dec 2014 19:20:19 +0300 Message-Id: <1417796424-9909-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1417796424-9909-1-git-send-email-maxim.uvarov@linaro.org> References: <1417796424-9909-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv6 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.217.178 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)