From patchwork Thu Dec 4 12:00:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 41931 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5581C2486D for ; Thu, 4 Dec 2014 12:01:11 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id ge10sf7288184lab.4 for ; Thu, 04 Dec 2014 04:01:10 -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=Kk7qN5Zx4pcxZPchFDalRd4sztrzOc9KIQQl8E325owMTpRVc9TuXRemWdD+G1DpIm h21jXADAwZ760RtgXwpv0m3e1vEdzQfIMfc2mh0A1LX6XB0/JQhDM7j2oI3tAPSRfW29 XsFOfrvv0jDztsAW291qKgs/07SF0faovbg8JZQDGk9WSR+IhiK7cE/7VrZ6llV3i8GM IS5Y8wUbdfNW0XeuLuzZkrIHBsWC/mL5yB4eWC1JllDmEHpwdJ+0pXiEHn/GSG7LrHTn jQ+H3q5TUxZCexqbvL/Hf7A2bUujBlEpwdmoX3oZcl7v1TUdrJEwEGohttNvokXsHJz8 ujBQ== X-Gm-Message-State: ALoCoQmAbfHc+10MsjKyJcuxQxNzn7x0SCpW4FCt+Ussz+UU+iE5teXMr7306Om4VO3vUIURGBLx X-Received: by 10.112.42.104 with SMTP id n8mr9260lbl.19.1417694470217; Thu, 04 Dec 2014 04:01:10 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.67 with SMTP id 3ls273258las.61.gmail; Thu, 04 Dec 2014 04:01:10 -0800 (PST) X-Received: by 10.112.181.98 with SMTP id dv2mr9263223lbc.78.1417694470080; Thu, 04 Dec 2014 04:01:10 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id v2si12308874lbb.56.2014.12.04.04.01.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Dec 2014 04:01:10 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id l4so4404269lbv.26 for ; Thu, 04 Dec 2014 04:01:10 -0800 (PST) X-Received: by 10.152.43.12 with SMTP id s12mr8847526lal.67.1417694470005; Thu, 04 Dec 2014 04:01:10 -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 ew9csp21529lbc; Thu, 4 Dec 2014 04:01:09 -0800 (PST) X-Received: by 10.140.97.37 with SMTP id l34mr16429943qge.43.1417694468624; Thu, 04 Dec 2014 04:01:08 -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 n77si31128623qgd.64.2014.12.04.04.01.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 04 Dec 2014 04:01:08 -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 1XwV5m-00076U-1l; Thu, 04 Dec 2014 12:01:06 +0000 Received: from mail-la0-f42.google.com ([209.85.215.42]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XwV5b-00075R-S4 for lng-odp@lists.linaro.org; Thu, 04 Dec 2014 12:00:55 +0000 Received: by mail-la0-f42.google.com with SMTP id gd6so654885lab.15 for ; Thu, 04 Dec 2014 04:00:50 -0800 (PST) X-Received: by 10.112.235.135 with SMTP id um7mr9247053lbc.96.1417694449962; Thu, 04 Dec 2014 04:00:49 -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 f7sm7172882lam.26.2014.12.04.04.00.48 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Dec 2014 04:00:49 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 4 Dec 2014 15:00:34 +0300 Message-Id: <1417694439-13861-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1417694439-13861-1-git-send-email-maxim.uvarov@linaro.org> References: <1417694439-13861-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv5 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.181 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)