From patchwork Mon Dec 1 16:15:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 41787 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 6BA0C20672 for ; Mon, 1 Dec 2014 16:16:09 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id ge10sf3306483lab.4 for ; Mon, 01 Dec 2014 08:16:08 -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=L5ipjGPKOk7prKF/yV44XJGYl/2UTUpNoPZ2R0PKkN1T2Oi1LOKW3NhNf1f36ZxYIs Ia9OIf0xIxzKL0z5+4WwossfexvsBokCiVN4+BVesxxNU3hB/JIN/9ppF6rLv+2rnBUX FhtTO2FVn6MSoTcGEBreBRHDQwDow6aJOm61NDvZDzBd2wxDEYjYwV1zBAy6Lva90/sA jl/BRAuVpeQvG0xrABIfwzs9ZYmnTpSfxH7lMVvDYO0SiBTniDogf3Y2VDVXo39Fzw3g p2z8YG3dVv9EiZfqqbVNTXWP4GMhucqSQ/urwJGaH7f41VY8F3tybFlqF1b5T8tVbM61 KP3A== X-Gm-Message-State: ALoCoQnbYS/KV8lgsc7oMoLipjGFRxEMvtMs7H2476IA4wPTZWHI0Y/YLQh8d7Gt/FvWYAj7tIPz X-Received: by 10.180.8.9 with SMTP id n9mr13932425wia.6.1417450568012; Mon, 01 Dec 2014 08:16:08 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.5 with SMTP id r5ls154470lae.47.gmail; Mon, 01 Dec 2014 08:16:07 -0800 (PST) X-Received: by 10.152.36.165 with SMTP id r5mr56895768laj.91.1417450567765; Mon, 01 Dec 2014 08:16:07 -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 kv10si18037526lac.131.2014.12.01.08.16.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 08:16:07 -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 pv20so4409478lab.27 for ; Mon, 01 Dec 2014 08:16:07 -0800 (PST) X-Received: by 10.112.138.137 with SMTP id qq9mr57337545lbb.80.1417450567643; Mon, 01 Dec 2014 08:16:07 -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 ew9csp319879lbc; Mon, 1 Dec 2014 08:16:06 -0800 (PST) X-Received: by 10.140.25.179 with SMTP id 48mr2035422qgt.24.1417450566004; Mon, 01 Dec 2014 08:16:06 -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 ic2si20980182qcb.29.2014.12.01.08.16.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 01 Dec 2014 08:16:05 -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 1XvTdr-0007B2-9w; Mon, 01 Dec 2014 16:16:03 +0000 Received: from mail-la0-f50.google.com ([209.85.215.50]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XvTdh-0007AG-AO for lng-odp@lists.linaro.org; Mon, 01 Dec 2014 16:15:53 +0000 Received: by mail-la0-f50.google.com with SMTP id pn19so8383733lab.9 for ; Mon, 01 Dec 2014 08:15:47 -0800 (PST) X-Received: by 10.153.11.133 with SMTP id ei5mr58062704lad.75.1417450547082; Mon, 01 Dec 2014 08:15:47 -0800 (PST) Received: from localhost.localdomain ([188.92.105.210]) by mx.google.com with ESMTPSA id ar4sm4819466lbc.48.2014.12.01.08.15.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 08:15:46 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 1 Dec 2014 19:15:27 +0300 Message-Id: <1417450537-7640-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1417450537-7640-1-git-send-email-maxim.uvarov@linaro.org> References: <1417450537-7640-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv4 01/11] 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 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)