patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 17.11 1/2] table: fix casting cuckoo hash function
@ 2019-01-03  8:26 Yongseok Koh
  2019-01-03  8:26 ` [dpdk-stable] [PATCH 17.11 2/2] net/nfp: replace strncpy by strlcpy Yongseok Koh
  2019-01-03  8:29 ` [dpdk-stable] [PATCH 17.11 1/2] table: fix casting cuckoo hash function Yongseok Koh
  0 siblings, 2 replies; 4+ messages in thread
From: Yongseok Koh @ 2019-01-03  8:26 UTC (permalink / raw)
  To: alejandro.lucero, cristian.dumitrescu; +Cc: stable, guruprasadx.rao

GCC 8.1 error:

lib/librte_table/rte_table_hash_cuckoo.c: In function
‘rte_table_hash_cuckoo_create’:
lib/librte_table/rte_table_hash_cuckoo.c:139:16: error: cast between
incompatible function types from ‘rte_table_hash_op_hash’ {aka ‘long
unsigned int (*)(void *, void *, unsigned int,  long unsigned int)’} to
‘uint32_t (*)(const void *, uint32_t,  uint32_t)’ {aka ‘unsigned int
(*)(const void *, unsigned int,  unsigned int)’}
[-Werror=cast-function-type]
   .hash_func = (rte_hash_function)(p->f_hash),
                ^

This issue is fixed by [1] in dpdk/master, but this patch is a workaround
to not break API/ABI in stable branch and originally suggested by
Andy Green [2].

[1] commit 8ea41438832a ("table: add dedicated params struct for cuckoo hash")
[2] https://mails.dpdk.org/archives/dev/2018-May/100405.html

Fixes: 5a80bf0ae613 ("table: add cuckoo hash")
Cc: guruprasadx.rao@intel.com

Suggested-by: Andy Green <andy@warmcat.com>
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 lib/librte_table/rte_table_hash_cuckoo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_table/rte_table_hash_cuckoo.c b/lib/librte_table/rte_table_hash_cuckoo.c
index f3845c752..c65228254 100644
--- a/lib/librte_table/rte_table_hash_cuckoo.c
+++ b/lib/librte_table/rte_table_hash_cuckoo.c
@@ -136,7 +136,7 @@ rte_table_hash_cuckoo_create(void *params,
 	struct rte_hash_parameters hash_cuckoo_params = {
 		.entries = p->n_keys,
 		.key_len = p->key_size,
-		.hash_func = (rte_hash_function)(p->f_hash),
+		.hash_func = (rte_hash_function)(void *)(p->f_hash),
 		.hash_func_init_val = p->seed,
 		.socket_id = socket_id,
 		.name = p->name
-- 
2.11.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-stable] [PATCH 17.11 2/2] net/nfp: replace strncpy by strlcpy
  2019-01-03  8:26 [dpdk-stable] [PATCH 17.11 1/2] table: fix casting cuckoo hash function Yongseok Koh
@ 2019-01-03  8:26 ` Yongseok Koh
  2019-01-03  8:31   ` Yongseok Koh
  2019-01-03  8:29 ` [dpdk-stable] [PATCH 17.11 1/2] table: fix casting cuckoo hash function Yongseok Koh
  1 sibling, 1 reply; 4+ messages in thread
From: Yongseok Koh @ 2019-01-03  8:26 UTC (permalink / raw)
  To: alejandro.lucero, cristian.dumitrescu; +Cc: stable

GCC 8.1 error:

drivers/net/nfp/nfp_nspu.c: In function
‘nfp_nspu_set_bar_from_symbl.constprop’:
drivers/net/nfp/nfp_nspu.c:426:2: error: ‘strncpy’ output truncated
before terminating nul copying as many bytes from a string as its length
[-Werror=stringop-truncation]
  strncpy(sym_buf, symbl, strlen(symbl));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: dd63df2bfff3 ("net/nfp: add NSP symbol resolution command")
Cc: alejandro.lucero@netronome.com

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/nfp/nfp_nspu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_nspu.c b/drivers/net/nfp/nfp_nspu.c
index f90898321..ac5bce3b1 100644
--- a/drivers/net/nfp/nfp_nspu.c
+++ b/drivers/net/nfp/nfp_nspu.c
@@ -9,6 +9,7 @@
 
 #include <rte_log.h>
 #include <rte_byteorder.h>
+#include <rte_string_fns.h>
 
 #include "nfp_nfpu.h"
 
@@ -423,7 +424,7 @@ nfp_nspu_set_bar_from_symbl(nspu_desc_t *desc, const char *symbl,
 	if (!sym_buf)
 		return -ENOMEM;
 
-	strncpy(sym_buf, symbl, strlen(symbl));
+	strlcpy(sym_buf, symbl, sizeof(sym_buf));
 	ret = nspu_command(desc, NSP_CMD_GET_SYMBOL, 1, 1, sym_buf,
 			   NFP_SYM_DESC_LEN, strlen(symbl));
 	if (ret) {
-- 
2.11.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [PATCH 17.11 1/2] table: fix casting cuckoo hash function
  2019-01-03  8:26 [dpdk-stable] [PATCH 17.11 1/2] table: fix casting cuckoo hash function Yongseok Koh
  2019-01-03  8:26 ` [dpdk-stable] [PATCH 17.11 2/2] net/nfp: replace strncpy by strlcpy Yongseok Koh
@ 2019-01-03  8:29 ` Yongseok Koh
  1 sibling, 0 replies; 4+ messages in thread
From: Yongseok Koh @ 2019-01-03  8:29 UTC (permalink / raw)
  To: cristian.dumitrescu
  Cc: dpdk stable, guruprasadx.rao, jasvinder.singh, Alejandro Lucero


> On Jan 3, 2019, at 12:26 AM, Yongseok Koh <yskoh@mellanox.com> wrote:
> 
> GCC 8.1 error:
> 
> lib/librte_table/rte_table_hash_cuckoo.c: In function
> ‘rte_table_hash_cuckoo_create’:
> lib/librte_table/rte_table_hash_cuckoo.c:139:16: error: cast between
> incompatible function types from ‘rte_table_hash_op_hash’ {aka ‘long
> unsigned int (*)(void *, void *, unsigned int,  long unsigned int)’} to
> ‘uint32_t (*)(const void *, uint32_t,  uint32_t)’ {aka ‘unsigned int
> (*)(const void *, unsigned int,  unsigned int)’}
> [-Werror=cast-function-type]
>   .hash_func = (rte_hash_function)(p->f_hash),
>                ^
> 
> This issue is fixed by [1] in dpdk/master, but this patch is a workaround
> to not break API/ABI in stable branch and originally suggested by
> Andy Green [2].
> 
> [1] commit 8ea41438832a ("table: add dedicated params struct for cuckoo hash")
> [2] https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmails.dpdk.org%2Farchives%2Fdev%2F2018-May%2F100405.html&amp;data=02%7C01%7Cyskoh%40mellanox.com%7C8338e137d62644ae802908d6715535e6%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636821008168448180&amp;sdata=v%2BFZ7xAoihB%2BdrpxXcqVtlcM%2FlUIPiK73%2FmTTLHPI7Q%3D&amp;reserved=0
> 
> Fixes: 5a80bf0ae613 ("table: add cuckoo hash")
> Cc: guruprasadx.rao@intel.com
> 
> Suggested-by: Andy Green <andy@warmcat.com>
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> ---

Applied to stable/17.11.
Cristian, let me know if you have any objection.

Thanks,
Yongseok

> lib/librte_table/rte_table_hash_cuckoo.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_table/rte_table_hash_cuckoo.c b/lib/librte_table/rte_table_hash_cuckoo.c
> index f3845c752..c65228254 100644
> --- a/lib/librte_table/rte_table_hash_cuckoo.c
> +++ b/lib/librte_table/rte_table_hash_cuckoo.c
> @@ -136,7 +136,7 @@ rte_table_hash_cuckoo_create(void *params,
> 	struct rte_hash_parameters hash_cuckoo_params = {
> 		.entries = p->n_keys,
> 		.key_len = p->key_size,
> -		.hash_func = (rte_hash_function)(p->f_hash),
> +		.hash_func = (rte_hash_function)(void *)(p->f_hash),
> 		.hash_func_init_val = p->seed,
> 		.socket_id = socket_id,
> 		.name = p->name
> -- 
> 2.11.0
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [PATCH 17.11 2/2] net/nfp: replace strncpy by strlcpy
  2019-01-03  8:26 ` [dpdk-stable] [PATCH 17.11 2/2] net/nfp: replace strncpy by strlcpy Yongseok Koh
@ 2019-01-03  8:31   ` Yongseok Koh
  0 siblings, 0 replies; 4+ messages in thread
From: Yongseok Koh @ 2019-01-03  8:31 UTC (permalink / raw)
  To: Alejandro Lucero; +Cc: dpdk stable


> On Jan 3, 2019, at 12:26 AM, Yongseok Koh <yskoh@mellanox.com> wrote:
> 
> GCC 8.1 error:
> 
> drivers/net/nfp/nfp_nspu.c: In function
> ‘nfp_nspu_set_bar_from_symbl.constprop’:
> drivers/net/nfp/nfp_nspu.c:426:2: error: ‘strncpy’ output truncated
> before terminating nul copying as many bytes from a string as its length
> [-Werror=stringop-truncation]
>  strncpy(sym_buf, symbl, strlen(symbl));
>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Fixes: dd63df2bfff3 ("net/nfp: add NSP symbol resolution command")
> Cc: alejandro.lucero@netronome.com
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> ---

Applied to stable/17.11.
Alejandro, let me know if you have any objection.

Thanks,
Yongseok

> drivers/net/nfp/nfp_nspu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/nfp/nfp_nspu.c b/drivers/net/nfp/nfp_nspu.c
> index f90898321..ac5bce3b1 100644
> --- a/drivers/net/nfp/nfp_nspu.c
> +++ b/drivers/net/nfp/nfp_nspu.c
> @@ -9,6 +9,7 @@
> 
> #include <rte_log.h>
> #include <rte_byteorder.h>
> +#include <rte_string_fns.h>
> 
> #include "nfp_nfpu.h"
> 
> @@ -423,7 +424,7 @@ nfp_nspu_set_bar_from_symbl(nspu_desc_t *desc, const char *symbl,
> 	if (!sym_buf)
> 		return -ENOMEM;
> 
> -	strncpy(sym_buf, symbl, strlen(symbl));
> +	strlcpy(sym_buf, symbl, sizeof(sym_buf));
> 	ret = nspu_command(desc, NSP_CMD_GET_SYMBOL, 1, 1, sym_buf,
> 			   NFP_SYM_DESC_LEN, strlen(symbl));
> 	if (ret) {
> -- 
> 2.11.0
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-03  8:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-03  8:26 [dpdk-stable] [PATCH 17.11 1/2] table: fix casting cuckoo hash function Yongseok Koh
2019-01-03  8:26 ` [dpdk-stable] [PATCH 17.11 2/2] net/nfp: replace strncpy by strlcpy Yongseok Koh
2019-01-03  8:31   ` Yongseok Koh
2019-01-03  8:29 ` [dpdk-stable] [PATCH 17.11 1/2] table: fix casting cuckoo hash function Yongseok Koh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).