From patchwork Wed Aug 5 15:26:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 51955 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 patches.linaro.org (Postfix) with ESMTPS id 8EECD229FD for ; Wed, 5 Aug 2015 15:27:30 +0000 (UTC) Received: by lbbnr7 with SMTP id nr7sf14322575lbb.2 for ; Wed, 05 Aug 2015 08:27:29 -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: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=aSjHDbc1nfSFWIzs7dfHcMJRjQ6BQhrJ8BUHtazGWtM=; b=ggItNIn/D+h/MDzatBlM3GRSNG0GMxh/bPzRh4+nn/r4I2QIrWuD/KLfMmeNse+c65 l2QIvL9jmS4XuiXMoJ77tledrkApCGPOFKPtyh9xsJoEpFmS2OVpT4I12G+PnhCvZDgI U+YTQVdbz+elsLTzfFl5osyTFiD8++w6aYdZyvngAVerbpmFHeUEezySW5y1HUkQQK/G h39X/O6BhRdcojTh7UguXuc26axEgEvBl640hUlYj7IbREqHlipm1pTm4EYclc2sqTCw ATpgP0tznUDkn/YWPPWQNcEQWw4sg/bKZRXGHEW4WO96n7Sruql+oB3AgRenYwWTazGH 4r7A== X-Gm-Message-State: ALoCoQkQiJNRo7hmty5yRBTzamY0q7Ok3k0UzMfbLQ8UfWBIZNXK3GGN47Es4p2IT8JDHDx56c0N X-Received: by 10.152.28.100 with SMTP id a4mr2916328lah.4.1438788449292; Wed, 05 Aug 2015 08:27:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.34 with SMTP id n2ls192404laj.15.gmail; Wed, 05 Aug 2015 08:27:29 -0700 (PDT) X-Received: by 10.112.144.199 with SMTP id so7mr9760976lbb.109.1438788449104; Wed, 05 Aug 2015 08:27:29 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id f3si2398356lag.4.2015.08.05.08.27.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Aug 2015 08:27:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by labjt7 with SMTP id jt7so13630291lab.0 for ; Wed, 05 Aug 2015 08:27:29 -0700 (PDT) X-Received: by 10.112.126.101 with SMTP id mx5mr9942784lbb.35.1438788448932; Wed, 05 Aug 2015 08:27:28 -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.7.198 with SMTP id l6csp434772lba; Wed, 5 Aug 2015 08:27:27 -0700 (PDT) X-Received: by 10.50.111.164 with SMTP id ij4mr10718195igb.70.1438788447227; Wed, 05 Aug 2015 08:27:27 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id o66si2710014ioe.80.2015.08.05.08.27.23; Wed, 05 Aug 2015 08:27:27 -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 8EB8161FC3; Wed, 5 Aug 2015 15:27:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal 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 ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 44A2561F43; Wed, 5 Aug 2015 15:27:19 +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 1E0C661FBA; Wed, 5 Aug 2015 15:26:57 +0000 (UTC) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by lists.linaro.org (Postfix) with ESMTPS id 6CC3461F43 for ; Wed, 5 Aug 2015 15:26:55 +0000 (UTC) Received: by wibxm9 with SMTP id xm9so72268253wib.1 for ; Wed, 05 Aug 2015 08:26:54 -0700 (PDT) X-Received: by 10.194.87.4 with SMTP id t4mr22937105wjz.84.1438788414612; Wed, 05 Aug 2015 08:26:54 -0700 (PDT) Received: from e106441.cambridge.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id y13sm4637638wjq.26.2015.08.05.08.26.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Aug 2015 08:26:54 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Wed, 5 Aug 2015 16:26:39 +0100 Message-Id: <1438788402-9250-1-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 X-Topics: patch Subject: [lng-odp] [PATCH 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.45 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 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 f5a5824..14532a3 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -28,6 +28,8 @@ extern "C" { #include #include +#define PKTIO_NAME_LEN 64 + /* Forward declaration */ struct pktio_if_ops; @@ -51,7 +53,7 @@ struct pktio_entry { * API for IO */ }; 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() */ }; diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index f3a4543..57db6e3 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; } @@ -236,7 +236,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); unlock_entry_classifier(pktio_entry); } @@ -301,7 +302,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);