From patchwork Tue Dec 9 17:44:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 42064 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 30386244AC for ; Tue, 9 Dec 2014 17:45:19 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id q1sf827332lam.10 for ; Tue, 09 Dec 2014 09:45:18 -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=emmrm31b/yMmP23enQeO93JeE7lbQ9l07qunO+UFwKA=; b=DrsiKOIpgfiCdgSMy2mwZYyT5/ojBanZGKAsC5PLQ3e2zNnkjRRU0qxgRNTXWMgpcW D7s/ZZqEQTponYzMUcvSHzBS7wJvPU47eMI3+3bfxLfyjTgGJCqdGgHSjXRBpstM3k0Z q9T7wb+jZ36/HxYTm3Dblx16P64hVxQ56ohS0ENFX+WdC8gWlftxoT+V9pGG4Uo2BRco ReNze5s4C52WvNuElUATBRfxdhN4E6juGn2uu3Sxso6cB9CiT18g8IAgpQvP8EQJXFiT c25KaDO48M/veYMjWLZKzptqHZH/k3vLl2PcLV4Gi0uO35fTTVWtHKj0dumf0blMeOdV oaaQ== X-Gm-Message-State: ALoCoQmnKdi9sShttsYpxtjJDUDZj2kyI7vURxENEHRFuOU20aZmKEYjl9pUUvUPDplJXzkpU/xn X-Received: by 10.180.24.35 with SMTP id r3mr776291wif.0.1418147118065; Tue, 09 Dec 2014 09:45:18 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.97 with SMTP id l1ls52571lam.59.gmail; Tue, 09 Dec 2014 09:45:17 -0800 (PST) X-Received: by 10.152.42.198 with SMTP id q6mr22630715lal.48.1418147117630; Tue, 09 Dec 2014 09:45:17 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id 9si31673lar.40.2014.12.09.09.45.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Dec 2014 09:45:17 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id hv19so972338lab.0 for ; Tue, 09 Dec 2014 09:45:17 -0800 (PST) X-Received: by 10.152.43.12 with SMTP id s12mr22635755lal.67.1418147117546; Tue, 09 Dec 2014 09:45:17 -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 ew9csp786913lbc; Tue, 9 Dec 2014 09:45:16 -0800 (PST) X-Received: by 10.229.196.70 with SMTP id ef6mr7848449qcb.31.1418147115657; Tue, 09 Dec 2014 09:45:15 -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 z77si1953091qgz.17.2014.12.09.09.45.14 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 09 Dec 2014 09:45:15 -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 1XyOqX-0005TD-CL; Tue, 09 Dec 2014 17:45:13 +0000 Received: from mail-la0-f45.google.com ([209.85.215.45]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XyOqN-0005Pp-T6 for lng-odp@lists.linaro.org; Tue, 09 Dec 2014 17:45:04 +0000 Received: by mail-la0-f45.google.com with SMTP id gq15so967478lab.4 for ; Tue, 09 Dec 2014 09:44:58 -0800 (PST) X-Received: by 10.112.131.1 with SMTP id oi1mr22739644lbb.2.1418147097951; Tue, 09 Dec 2014 09:44:57 -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 m9sm10385laa.28.2014.12.09.09.44.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Dec 2014 09:44:56 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Tue, 9 Dec 2014 20:44:45 +0300 Message-Id: <1418147090-29055-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1418147090-29055-1-git-send-email-maxim.uvarov@linaro.org> References: <1418147090-29055-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv8 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.41 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 Reviewed-by: Stuart Haslam Reviewed-by: Victor Kamensky --- 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)