From patchwork Wed Oct 14 12:06:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 54908 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 9357323012 for ; Wed, 14 Oct 2015 12:07:32 +0000 (UTC) Received: by wibzt1 with SMTP id zt1sf26217676wib.0 for ; Wed, 14 Oct 2015 05:07:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to: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=Mcj95VXZGJfAPArzp22L50OX4/zvAg7HaqUluJQ2zx0=; b=DTsLLYfJV5qcbalR8rXQ5DWstLUfMa+KwfeBVxSuU+xyxEQmzRwXYNiucWBsWKjF+b tFI4Mp1FzdSa7EEfjz6S1cYXHKj/KX5/ypx3GKsH9FrD07pZo5UT1LHJmdT2OYOOE5Zq 5yb0vjTDkrJnd3sGkVclJwIMWthmznWsp2Q51NpIoiG4xeRUcz/3kD7FzixBhxkBPo83 gAehC8D7mlzUtuWg2yqTNpiK6bOflaKCv/unmoR2J4gsBeVfuk6KiFhIOaVLTFyKosyK lbbfQFNAQnzig0IFbs9bB0oJ1Ah/RYGbFbMOJuM1OfkYb6V/BWXzTYzMRypDR+SHLsE6 svFQ== X-Gm-Message-State: ALoCoQnLRJ6xzptbFEGHG1d6YcwKLOmP8emf5OoUnevNikFZgNyT2hwt+/ZfSJDERWVogFAeFsyq X-Received: by 10.112.145.3 with SMTP id sq3mr697040lbb.7.1444824451803; Wed, 14 Oct 2015 05:07:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.206.211 with SMTP id e202ls32216lfg.109.gmail; Wed, 14 Oct 2015 05:07:31 -0700 (PDT) X-Received: by 10.25.147.76 with SMTP id v73mr939045lfd.102.1444824451664; Wed, 14 Oct 2015 05:07:31 -0700 (PDT) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id zf4si5321349lbb.129.2015.10.14.05.07.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Oct 2015 05:07:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lffy185 with SMTP id y185so10149464lff.2 for ; Wed, 14 Oct 2015 05:07:31 -0700 (PDT) X-Received: by 10.25.207.82 with SMTP id f79mr938493lfg.73.1444824450768; Wed, 14 Oct 2015 05:07:30 -0700 (PDT) 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.59.35 with SMTP id w3csp2691086lbq; Wed, 14 Oct 2015 05:07:29 -0700 (PDT) X-Received: by 10.140.107.54 with SMTP id g51mr3410495qgf.38.1444824449856; Wed, 14 Oct 2015 05:07:29 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f73si7474333qkh.96.2015.10.14.05.07.29; Wed, 14 Oct 2015 05:07:29 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 81C3E61CB0; Wed, 14 Oct 2015 12:07:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C2F4C61B6B; Wed, 14 Oct 2015 12:06:49 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BC54061BBF; Wed, 14 Oct 2015 12:06:42 +0000 (UTC) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by lists.linaro.org (Postfix) with ESMTPS id B178861B6B for ; Wed, 14 Oct 2015 12:06:41 +0000 (UTC) Received: by wicge5 with SMTP id ge5so97882727wic.0 for ; Wed, 14 Oct 2015 05:06:40 -0700 (PDT) X-Received: by 10.194.90.16 with SMTP id bs16mr4245606wjb.37.1444824400493; Wed, 14 Oct 2015 05:06:40 -0700 (PDT) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id gn9sm2638958wib.0.2015.10.14.05.06.39 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Oct 2015 05:06:39 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Wed, 14 Oct 2015 13:06:25 +0100 Message-Id: <1444824388-25708-2-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1444824388-25708-1-git-send-email-stuart.haslam@linaro.org> References: <1444824388-25708-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 1/4] linux-generic: pktio: extend maximum devname length X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stuart.haslam@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.50 as permitted sender) smtp.mailfrom=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 Signed-off-by: Stuart Haslam --- platform/linux-generic/include/odp_packet_io_internal.h | 4 +++- platform/linux-generic/odp_packet_io.c | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 353b40d..590b816 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -30,6 +30,8 @@ extern "C" { #include #include +#define PKTIO_NAME_LEN 256 + /* Forward declaration */ struct pktio_if_ops; @@ -58,7 +60,7 @@ struct pktio_entry { STATE_STOP } state; classifier_t cls; /**< classifier linked with this pktio*/ - char name[IF_NAMESIZE]; /**< name of pktio provided to + char name[PKTIO_NAME_LEN]; /**< name of pktio provided to pktio_open() */ odp_pktio_param_t param; }; diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index fa0817a..07bcf78 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -203,10 +203,10 @@ static odp_pktio_t setup_pktio_entry(const char *dev, odp_pool_t pool, int ret = -1; int pktio_if; - if (strlen(dev) >= IF_NAMESIZE) { + if (strlen(dev) >= PKTIO_NAME_LEN - 1) { /* ioctl names limitation */ ODP_ERR("pktio name %s is too big, limit is %d bytes\n", - dev, IF_NAMESIZE); + dev, PKTIO_NAME_LEN - 1); return ODP_PKTIO_INVALID; } @@ -238,7 +238,8 @@ static odp_pktio_t setup_pktio_entry(const char *dev, odp_pool_t pool, id = ODP_PKTIO_INVALID; ODP_ERR("Unable to init any I/O type.\n"); } else { - snprintf(pktio_entry->s.name, IF_NAMESIZE, "%s", dev); + snprintf(pktio_entry->s.name, + sizeof(pktio_entry->s.name), "%s", dev); pktio_entry->s.state = STATE_STOP; unlock_entry_classifier(pktio_entry); } @@ -343,7 +344,7 @@ odp_pktio_t odp_pktio_lookup(const char *dev) lock_entry(entry); if (!is_free(entry) && - strncmp(entry->s.name, dev, IF_NAMESIZE) == 0) + strncmp(entry->s.name, dev, sizeof(entry->s.name)) == 0) id = _odp_cast_scalar(odp_pktio_t, i); unlock_entry(entry);