From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stephen@networkplumber.org>
Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67])
 by dpdk.org (Postfix) with ESMTP id 7EF8E47CD
 for <dev@dpdk.org>; Thu, 17 May 2018 16:40:19 +0200 (CEST)
Received: by mail-pg0-f67.google.com with SMTP id n9-v6so1926418pgq.5
 for <dev@dpdk.org>; Thu, 17 May 2018 07:40:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=iEnvS0ztgup7poPTvoF+zfZAzqlc6/gD+t/ruqhpllQ=;
 b=BHvGhJwwDerzf2qIf8iKfT/F+u7yn4AnMtmHEvjcFsX9vk+heEz1nMRDRuDE5ZWTRj
 WbMgZSopOQAS4t3IY5ZStttf5eMOuGOMENPNq8FS4rNvCc+d/8oUDd4iT7qbr4f1/XNo
 R5ikkiiL4DgEPyO40pzQaspNs8yyfn17p3pjDmB7dSheh/PAxXJSddeb8EesDQLEgCyz
 jwQ0P/x/OlCJNa1Gfkr5JxkSmNzPd70vKM1pGB4Kp3zleLfUOruHrni9drxVQEjw1TA4
 Q5CaHzERpd5vo+1yi4EskoBmPCEEToc1tIp/Y1W8JW22zMoqoeqzXaZWcwO1itd4Ec2L
 fKgg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=iEnvS0ztgup7poPTvoF+zfZAzqlc6/gD+t/ruqhpllQ=;
 b=iawU1MSAgR+47upm2LjE+hguA74Bs6Vq/Y5qs46DZX9ri1SrQ+9ER50i/+Q+sOaGWN
 NwtHWck2uy5Ed52aSitJZFDdjuw2DlZi7vQzf4+3ahXmELkmR2ity0PB/uwvH90ELYMM
 tDE+9UIznflkuSg3BQ9SELuxCGCCGThkDMo/qr8MGNR1cou3mG+0+qrj5904Zp3u8OqI
 uIKuliRAOAf8W5mV75bUks6PORJYBQ36uDoiM9Q6LhGwVUcI7hyFXQbpjU11/X1uKS/x
 zhs0Xf0m0FrOcpaDdA75yYe6ubkG790P368hl+mbsRj07aOt/iHIV0cVRmDrHd9MUoqS
 j7ng==
X-Gm-Message-State: ALKqPwfL++5uv0frXjBWxGZmvLy6e04/q6DyNXp4PrIFHORBbgfe+FuR
 XYewEeMmaV9ZsVWV9SCRZXUslVpJ5j4=
X-Google-Smtp-Source: AB8JxZoisDjUmkoIW5sdIY5eN8NeUH4JiAKtn7ERHis0t0q/lGZSWUag2xJX+TOGXdpQa576Bx4ufA==
X-Received: by 2002:a63:b948:: with SMTP id
 v8-v6mr4306253pgo.129.1526568018685; 
 Thu, 17 May 2018 07:40:18 -0700 (PDT)
Received: from xeon-e3 (204-195-35-107.wavecable.com. [204.195.35.107])
 by smtp.gmail.com with ESMTPSA id g20-v6sm8470837pfi.163.2018.05.17.07.40.18
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 17 May 2018 07:40:18 -0700 (PDT)
Date: Thu, 17 May 2018 07:40:16 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Andy Green <andy@warmcat.com>
Cc: dev@dpdk.org
Message-ID: <20180517074016.7873db83@xeon-e3>
In-Reply-To: <152656494207.46638.7698825480823239153.stgit@localhost.localdomain>
References: <152656480225.46638.3271983577765861155.stgit@localhost.localdomain>
 <152656494207.46638.7698825480823239153.stgit@localhost.localdomain>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign
 conv warning in lstrcpy
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 17 May 2018 14:40:19 -0000

On Thu, 17 May 2018 21:49:02 +0800
Andy Green <andy@warmcat.com> wrote:

> In file included from ./dpdk/dpdk.c:88:
> /projects/lagopus/src/dpdk/build/include/rte_string_fns.h: In
> function 'rte_strlcpy':
> /projects/lagopus/src/dpdk/build/include/rte_string_fns.h:58:9:
> warning: conversion to 'size_t' {aka 'long unsigned int'} from
> 'int' may change the sign of the result [-Wsign-conversion]
>   return snprintf(dst, size, "%s", src);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ---
>  lib/librte_eal/common/include/rte_string_fns.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
> index fcbb42e00..97597a148 100644
> --- a/lib/librte_eal/common/include/rte_string_fns.h
> +++ b/lib/librte_eal/common/include/rte_string_fns.h
> @@ -55,7 +55,7 @@ rte_strsplit(char *string, int stringlen,
>  static inline size_t
>  rte_strlcpy(char *dst, const char *src, size_t size)
>  {
> -	return snprintf(dst, size, "%s", src);
> +	return (size_t)snprintf(dst, size, "%s", src);
>  }
>  
>  /* pull in a strlcpy function */
> 

I still like the BSD function better because it guarantees all data
in the buffer is zero'd snprintf does not.