From patchwork Mon Dec 1 14:08:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 41772 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 867DD20672 for ; Mon, 1 Dec 2014 14:09:18 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id f15sf6684191lbj.7 for ; Mon, 01 Dec 2014 06:09:17 -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=r4nykBfhrtTLSKHf6wPJ7UQTBSiB90JUrp/Kpnd6VO4=; b=bwWOXBFuHCocjwao+EXY7kAeiiRndtf/hNOXBb2pG1mP1MtUMFefBfYOuQqPhE9E6g c0FxBRkNb5FsHpOp9sJHeg6mFE/PpZW6CsQAt86+STd33XGlk0g+rmPN6wgleYjM8Mjj E5Hg0+gDkLSMVJcwCiAmoDhZAdrTsFNVfARvFMlltICP26febF3cVP7ctwmyqxAlau1w fGNWq5TRapZc9ehDZ6b/N2t4UroeGuD1TKutGJ97hJ4gEvZvGRJgktseEMvQ2Fx/Nk5K +oajE43ywLrTGY+UXSgrViBYTD7zK56mvnzwGxjY/25n0MB0SmG5AQ1wjcsQlfnQMBpr wA4g== X-Gm-Message-State: ALoCoQnz/xdZdGAfaa8/A5umH4iLlN65/66bWs7YWM9JjKRSkPFYCSkUVwLrg16HMdbcGz4WjsOw X-Received: by 10.112.159.199 with SMTP id xe7mr20232lbb.21.1417442957407; Mon, 01 Dec 2014 06:09:17 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.40 with SMTP id n8ls832698laj.73.gmail; Mon, 01 Dec 2014 06:09:17 -0800 (PST) X-Received: by 10.112.199.138 with SMTP id jk10mr11887549lbc.86.1417442957133; Mon, 01 Dec 2014 06:09:17 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id uc2si16599000lac.80.2014.12.01.06.09.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 06:09:17 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id q1so3835799lam.5 for ; Mon, 01 Dec 2014 06:09:17 -0800 (PST) X-Received: by 10.152.2.165 with SMTP id 5mr9391286lav.40.1417442957051; Mon, 01 Dec 2014 06:09: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 ew9csp293179lbc; Mon, 1 Dec 2014 06:09:15 -0800 (PST) X-Received: by 10.229.105.196 with SMTP id u4mr85430937qco.27.1417442954881; Mon, 01 Dec 2014 06:09:14 -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 d7si20579525qge.72.2014.12.01.06.09.14 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 01 Dec 2014 06:09:14 -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 1XvRf6-0000uJ-TA; Mon, 01 Dec 2014 14:09:12 +0000 Received: from mail-la0-f46.google.com ([209.85.215.46]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XvRev-0000rT-VP for lng-odp@lists.linaro.org; Mon, 01 Dec 2014 14:09:02 +0000 Received: by mail-la0-f46.google.com with SMTP id q1so3877006lam.19 for ; Mon, 01 Dec 2014 06:08:56 -0800 (PST) X-Received: by 10.112.16.39 with SMTP id c7mr56485147lbd.19.1417442936453; Mon, 01 Dec 2014 06:08:56 -0800 (PST) Received: from localhost.localdomain ([188.92.105.210]) by mx.google.com with ESMTPSA id or5sm4739750lbb.42.2014.12.01.06.08.54 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 06:08:55 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 1 Dec 2014 17:08:39 +0300 Message-Id: <1417442928-20680-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1417442928-20680-1-git-send-email-maxim.uvarov@linaro.org> References: <1417442928-20680-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 01/10] 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.46 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 c523350..acc03bb 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)); + /* valid socket() might be 0, set not initialized socket to -1 */ + entry->s.pkt_sock.sockfd = -1; + entry->s.pkt_sock_mmap.sockfd = -1; } static odp_pktio_t alloc_lock_pktio_entry(void)