From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by dpdk.org (Postfix) with ESMTP id 91F23ADB2 for ; Tue, 24 Feb 2015 10:41:37 +0100 (CET) Received: by mail-wi0-f180.google.com with SMTP id h11so23664188wiw.1 for ; Tue, 24 Feb 2015 01:41:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dB09gfrG1HU2Gnd4YOH4ZIjNFGTpfsFNZ6h+siSEvCQ=; b=IjqOqsFHTMpGWDU/n1MNE67JpCNx5PbLNFtuo9MUhvStKC5c9VX5ECbRHKZSQSZ9Z5 xHj/RCr4lxDhGAJ0CBzOR/f3QEo5aGsaLvCk1TK063jLIBGkv3JIbabt8WEDig6V9iBd axokfa/bye8DIrgxsrgo0CXxG2FI9lt8bZ1SMiDapRbMgxrXFiwwi5N5QUq/nfFDOHw8 H5uWI/UbMzFCI7YcTvxl6VvtuX4wAQHj62inpL7jnSgWv2HOPXP8mRcDS7BhfswS6h78 5CidvkuNZzF7v4Bg/qc1vmvQO/yBjgKN98ULj3zW1T/fE5Buuk7vFGDU3R2IjabJGFKU KqXg== X-Gm-Message-State: ALoCoQkmBj3v4OrOHEgrsn9fZa7XRUzwsghYwAsEPqIUhNWUERG23c+HPkoWPQ/FdLiHGhIzJlaR X-Received: by 10.180.21.133 with SMTP id v5mr28966571wie.27.1424770897292; Tue, 24 Feb 2015 01:41:37 -0800 (PST) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id dn1sm19709876wid.11.2015.02.24.01.41.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 01:41:36 -0800 (PST) From: David Marchand To: dev@dpdk.org Date: Tue, 24 Feb 2015 10:41:31 +0100 Message-Id: <1424770891-19243-1-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <54E5ED96.9040402@igel.co.jp> References: <54E5ED96.9040402@igel.co.jp> Subject: [dpdk-dev] [PATCH] devargs: restore empty devargs as "" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Feb 2015 09:41:37 -0000 Following commit c07691ae1089, an implicit change has been done in the devargs api. This triggers problem in virtual pmds that did not check for parameters validity as it was implicitely valid. Fix this by restoring the empty argument as "" and add a note in the api. Restore associated tests. Fixes: c07691ae1089 ("devargs: remove limit on parameters length") Reported-by: Tetsuya Mukawa Signed-off-by: David Marchand --- app/test/test_devargs.c | 2 +- lib/librte_eal/common/eal_common_devargs.c | 11 +++++++---- lib/librte_eal/common/include/rte_devargs.h | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c index 08fb781..f7fc59c 100644 --- a/app/test/test_devargs.c +++ b/app/test/test_devargs.c @@ -107,7 +107,7 @@ test_devargs(void) devargs->pci.addr.devid != 0 || devargs->pci.addr.function != 1) goto fail; - if (devargs->args) + if (!devargs->args || strcmp(devargs->args, "") != 0) goto fail; free_devargs_list(); diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 3aace08..eadd719 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -73,10 +73,13 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) if (sep != NULL) { sep[0] = '\0'; devargs->args = strdup(sep + 1); - if (devargs->args == NULL) { - RTE_LOG(ERR, EAL, "cannot allocate for devargs args\n"); - goto fail; - } + } else { + devargs->args = strdup(""); + } + + if (devargs->args == NULL) { + RTE_LOG(ERR, EAL, "cannot allocate for devargs args\n"); + goto fail; } switch (devargs->type) { diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h index 996e180..6834333 100644 --- a/lib/librte_eal/common/include/rte_devargs.h +++ b/lib/librte_eal/common/include/rte_devargs.h @@ -88,7 +88,7 @@ struct rte_devargs { char drv_name[32]; } virtual; }; - /** Arguments string as given by user. */ + /** Arguments string as given by user or "" for no argument. */ char *args; }; -- 1.7.10.4