From patchwork Wed Dec 3 15:05:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 41850 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C9B9325E66 for ; Wed, 3 Dec 2014 15:06:31 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf9680946lab.11 for ; Wed, 03 Dec 2014 07:06:30 -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=YwiLxPLwT+nmvyx1crPMQNZv1IBUNKBpWoOgp03KZE/xxmxF5OmVORPp7xLyyH4f4K 1NPwKMcTg4woF/eUEsXqd4t2pcN7GYDJytrl+VJighVdFNL1eHOcg8KXRQzPx9Jw+Bpc j/sXvl2Ls64E0WhIdZIwlNL9dFi3V2XlR4axULYl8+2FXQ6ZV8YJPW/s39xCuIhOsjoM as4H5RtoObo+XeR4/4g5ODbgrlinW+DJFr5nk76y9yzIBMIRx42gzju9Juif9Wa6p/hi 6MKli4E7OizrJZuGf6jw6ybh+4jaudl5o52wWTM59GN7N8WyLr3MdqZd3iTz/c6g4hmm +gtw== X-Gm-Message-State: ALoCoQnvA6lcZz10BcYKS9obKP0XDgLCy2BsxYv8lflnfz1GDwyKPwp04zPB03zPAZus/hZGs1U/ X-Received: by 10.152.8.67 with SMTP id p3mr1183303laa.4.1417619190838; Wed, 03 Dec 2014 07:06:30 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.72 with SMTP id y8ls175198lay.99.gmail; Wed, 03 Dec 2014 07:06:30 -0800 (PST) X-Received: by 10.112.130.65 with SMTP id oc1mr4756153lbb.7.1417619190599; Wed, 03 Dec 2014 07:06:30 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id jn6si23234213lbc.119.2014.12.03.07.06.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 07:06:30 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id f15so13201608lbj.41 for ; Wed, 03 Dec 2014 07:06:30 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr4596448lbc.23.1417619190490; Wed, 03 Dec 2014 07:06:30 -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 ew9csp680264lbc; Wed, 3 Dec 2014 07:06:29 -0800 (PST) X-Received: by 10.236.32.40 with SMTP id n28mr6599545yha.16.1417619188754; Wed, 03 Dec 2014 07:06:28 -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 b67si231473ykd.48.2014.12.03.07.06.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Dec 2014 07:06:28 -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 1XwBVa-0005IL-EY; Wed, 03 Dec 2014 15:06:26 +0000 Received: from mail-lb0-f172.google.com ([209.85.217.172]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XwBVP-0005HY-V9 for lng-odp@lists.linaro.org; Wed, 03 Dec 2014 15:06:16 +0000 Received: by mail-lb0-f172.google.com with SMTP id u10so12403550lbd.31 for ; Wed, 03 Dec 2014 07:06:10 -0800 (PST) X-Received: by 10.112.159.129 with SMTP id xc1mr4838082lbb.24.1417619169989; Wed, 03 Dec 2014 07:06:09 -0800 (PST) Received: from localhost.localdomain ([188.92.105.210]) by mx.google.com with ESMTPSA id r4sm6449679lar.3.2014.12.03.07.06.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 07:06:08 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 3 Dec 2014 18:05:52 +0300 Message-Id: <1417619157-13690-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1417619157-13690-1-git-send-email-maxim.uvarov@linaro.org> References: <1417619157-13690-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv4 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.182 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)