From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id F043AA0679 for ; Wed, 3 Apr 2019 17:51:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B7DEF1B4C7; Wed, 3 Apr 2019 17:51:37 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 8A8A91B4BB for ; Wed, 3 Apr 2019 17:51:36 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id z5so7339585pfn.3 for ; Wed, 03 Apr 2019 08:51:36 -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=gkb3DoMA6M7Gtvl8DJ/bn1gpmG3nIOydYhyIy71URnQ=; b=YiBoulVS/yV+opbcVax0u1KooP/f+anllK0JYwWAQBSQfpICMkOyNmxwU276dXDd4/ tsNzkyA3JpzfRAWhV71IO3MWS7ePIyHH5YAisfsmzazbrajefN3lfIcFFRj7/FzC26eV 7g+BZtKEUNU+qCByACMclLc4+tJl6yzGM7keOBCdckVGMm4vpu4gmBLoXdRYu54hGS/a aVYUb/FRLoPvxSji66EoyZrS6KlgZA9IK/8dXfy4MpDiadb6A7orcT59vKs/rxYIH1uj kh1PNa9FIFhsJB/V6JEw7I0KkF0oFLHM/EuommsltfAf0aoIUwhriWVV7dKnp+ULVmtF s9CQ== 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=gkb3DoMA6M7Gtvl8DJ/bn1gpmG3nIOydYhyIy71URnQ=; b=M/PU0rVurPTr7Rv+j5jIIYt7bTFdDTc45FjEv2SZCi5XRxA1Za0pZQTXTpPdjG8trL A9yKnt9hwqNm+euN685Y6BbX9lMbBotG3/xA8sNwSdisLzxcwYFYvah/GpAOCaYu0rjJ wcUM26ZWiuLvmoZFXQw+L1wCUWgitsQS9/2LbngkWSOj6yUfb1uhT2BCpKj6o/7LYt3b +5Mtawq+BxOeJRun/TmDXUxSYH/K9gniWHY/O1/sWiFyMgrvUFjey0AciD3iGnJgNAwR 3QwgrN34aPx1+b8BWsA9WnlRjFgDaE9sxp979hzEe3otD3GAuKWwJcosoHecDQHf0I5N nBHA== X-Gm-Message-State: APjAAAU7DfdmOVYfRUiOjIcVmQ2IlPcDDOdQLhQPhnzHe3YTokAqyvrE PqXq+/6l1HsvuFrZqt1UFZ3zEw== X-Google-Smtp-Source: APXvYqw5YlqNB+DxXViemAUgrR4yW9ZHS3k8tlXsWTvjv1OKYhzv+OttqNCHcdnZATJt6OvKSigjyg== X-Received: by 2002:a63:115c:: with SMTP id 28mr393504pgr.270.1554306695454; Wed, 03 Apr 2019 08:51:35 -0700 (PDT) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id m25sm24159033pfa.175.2019.04.03.08.51.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Apr 2019 08:51:35 -0700 (PDT) Date: Wed, 3 Apr 2019 08:51:32 -0700 From: Stephen Hemminger To: Bruce Richardson Cc: dev@dpdk.org Message-ID: <20190403085132.1fa33194@shemminger-XPS-13-9360> In-Reply-To: <20190403144505.46234-5-bruce.richardson@intel.com> References: <20190403144505.46234-1-bruce.richardson@intel.com> <20190403144505.46234-5-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 4/5] replace snprintf with strlcpy without adding extra include X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190403155132.cREvYwxoktzQS7epVY3x6mi_SPFylCIzoDlg_Mj-998@z> On Wed, 3 Apr 2019 15:45:04 +0100 Bruce Richardson wrote: > diff --git a/lib/librte_ring/rte_ring.c b/lib/librte_ring/rte_ring.c > index d215acecc..a542f6f5d 100644 > --- a/lib/librte_ring/rte_ring.c > +++ b/lib/librte_ring/rte_ring.c > @@ -78,7 +78,7 @@ rte_ring_init(struct rte_ring *r, const char *name, unsigned count, > > /* init the ring structure */ > memset(r, 0, sizeof(*r)); > - ret = snprintf(r->name, sizeof(r->name), "%s", name); > + ret = strlcpy(r->name, name, sizeof(r->name)); > if (ret < 0 || ret >= (int)sizeof(r->name)) I would rather use the name length that is part of the header file. if (strnlen(name, RTE_RING_NAMESIZE) == RTE_RING_NAMESIZE) return -ENAMETOOLONG; strlcpy(r->name, name, sizeof(r->name))