From patchwork Fri Sep 4 13:20:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 53089 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id E2B142159E for ; Fri, 4 Sep 2015 13:22:27 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf6264977wic.1 for ; Fri, 04 Sep 2015 06:22:27 -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=d+ZrwLFqSgQdViZEnzQhqAGIZNSSG9exXpZhYY94ER8=; b=MUmFDpKUx9Ik6iWwiUNHIlOp2/FccI7zZHr8TCtfi3GrFGb9FtaRDiUNaqIjJlveeY Rjq5JxmjndkgxuODDzsy7fEJw2n2/meuGKBIb3Ym4Y77RkxcXHfw7KS+20eN6pWKB/iH VN0ghFfRr7lemrUR6T4juW0PtFJ3iqUCGOrAz0zlMD43HUH9rdPGAIJwPq6fwN2S92OC i1hTE8BSHdDpT6eD3yoU+L43AgT08zGw3NbD+kY4NgF5WG8Q2JCQz3wpuiW/QLGp0L/i jMTaajJfkzKQvI6mysqKmiGG/Uc7+rYCslDQbaI0rtvt0uimJ01s61j0ym0TVOMp9vZ+ cHrw== X-Gm-Message-State: ALoCoQm2R+n+/cf29LhlrghiVe09s3x3yyNVEmvj7Ty1QlKTOV2SLOEtI9qfR6T79D646ax/HU1U X-Received: by 10.152.28.100 with SMTP id a4mr1050300lah.4.1441372947228; Fri, 04 Sep 2015 06:22:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.100 with SMTP id a4ls335143lah.52.gmail; Fri, 04 Sep 2015 06:22:27 -0700 (PDT) X-Received: by 10.112.189.161 with SMTP id gj1mr3725421lbc.20.1441372947031; Fri, 04 Sep 2015 06:22:27 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id l1si2284927lbj.175.2015.09.04.06.22.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Sep 2015 06:22:26 -0700 (PDT) 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 lagj9 with SMTP id j9so13541393lag.2 for ; Fri, 04 Sep 2015 06:22:26 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr3712747lag.86.1441372946438; Fri, 04 Sep 2015 06:22:26 -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.164.42 with SMTP id yn10csp1969356lbb; Fri, 4 Sep 2015 06:22:24 -0700 (PDT) X-Received: by 10.140.145.145 with SMTP id 139mr5384295qhr.100.1441372944846; Fri, 04 Sep 2015 06:22:24 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z66si2798157qgd.11.2015.09.04.06.22.24; Fri, 04 Sep 2015 06:22:24 -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 11A0F61A3D; Fri, 4 Sep 2015 13:22:24 +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 050D661A01; Fri, 4 Sep 2015 13:22:16 +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 E665F61A0F; Fri, 4 Sep 2015 13:22:14 +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 063FF61804 for ; Fri, 4 Sep 2015 13:22:14 +0000 (UTC) Received: by wiclk2 with SMTP id lk2so17892812wic.1 for ; Fri, 04 Sep 2015 06:22:13 -0700 (PDT) X-Received: by 10.194.235.130 with SMTP id um2mr7641951wjc.1.1441372933031; Fri, 04 Sep 2015 06:22:13 -0700 (PDT) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id gt10sm4155421wib.20.2015.09.04.06.22.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Sep 2015 06:22:12 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Fri, 4 Sep 2015 14:20:26 +0100 Message-Id: <1441372829-12886-2-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1441372829-12886-1-git-send-email-stuart.haslam@linaro.org> References: <1441372829-12886-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 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.46 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 a21c683..bdffc15 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 256 + /* Forward declaration */ struct pktio_if_ops; @@ -55,7 +57,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 4e07766..5d15ff0 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -204,10 +204,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; } @@ -239,7 +239,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); } @@ -339,7 +340,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);