Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3989549imm; Tue, 29 May 2018 18:59:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLn5CXNSpq0rFrVwVmZgDq0f/T/acOk14hDxp+17MFRlMLofm5adjC1aBNYdvuD/cYjitOK X-Received: by 2002:a62:f0d:: with SMTP id x13-v6mr843936pfi.100.1527645574640; Tue, 29 May 2018 18:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527645574; cv=none; d=google.com; s=arc-20160816; b=av0pkEvx5CrSNs/cwA4JgNH/jkotDkT/h/CQDDeEqdBuB3qWeajD2kF+XfWzOXYe6u kH4sYJhsDmXoN+4YQooZqXdLmSxd9aD+TnNnobBVZ4P+xGPk4QfO8XxtwLcg+WsqypDj Ty5T7yKu4YJPMmT3xcMwJg3LUyv5lAH3GP/OhoUUjHnHM7AG6KLAccMpy4zxJkIWEyh7 y6GCv8/YwpnVBptVq26TSm3Rx+96m1E0ZQYieuDmC8uIVbGsFWbaMzQz/BsPTlxM7FiX ZUn1UgrfinLxUuD1IS+vkYrWIiMTJvZS0jjyND5EJz7a8bVPCIfSE/c5pRdQn5VZ9dIJ 6jPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=ZoloxK3yTzZJ7q8SM7DZ2NtN16ZQhni22ECVBpgehvY=; b=No+GsDG9jcwGYJWa1xtDUfzs+Jjds27mgXt8e49fLueXGwN1GeY4u8t4sn1/2gTYs7 I1QGzkmvKyK25QgcPjK/GqVwRcbRNyjuMHBgNaSN9JR8BdaaXPWKswsSQyVvwO+2BcCD 4RaEzAgcLdXqYgJujfUUdH0YN7T3gOme98WJu0HB3c3Zgzncc7R0IXZQNJnwCFJM2pV3 jNU+7VOP/FJdCL4rJfZx7Bihgh572btdO+HyDaPVYy5IcAP5Ugnz8YAtWaISdtcs0U4p o+mpZRdXB4ED2NmMtbacmE3ieD0SOmazezyFXcs+uIvjo7Czb1ubAc73I2moI/nuKOpI RJ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f8QYSLI3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si33122325plb.220.2018.05.29.18.59.20; Tue, 29 May 2018 18:59:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f8QYSLI3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754995AbeE3B5h (ORCPT + 99 others); Tue, 29 May 2018 21:57:37 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:46237 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751180AbeE3B5g (ORCPT ); Tue, 29 May 2018 21:57:36 -0400 Received: by mail-ot0-f193.google.com with SMTP id t1-v6so19301342ott.13 for ; Tue, 29 May 2018 18:57:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ZoloxK3yTzZJ7q8SM7DZ2NtN16ZQhni22ECVBpgehvY=; b=f8QYSLI38IAs32l+4YmHie943Bzsm1S4adYgNgFNZyue+Bp0nmTZP7RMQJwLZKW6hp BwNttFZsNul0u8zFXnriIRViDlcqZDPogwMYKu1GDGoUwtdjTG5xXYQzDvo/8Km9Bbw/ SF3RrxB30OWqV6sjAHU1NszIvgKB4DAKib/RNQRITp716Xt4dN3AtubZygvf5iZ83VfU kDZnQPX5svOSF0IriEr99NS5OBfj7TcM+sr7cAgAnP2Z5alTQ0NdbFt7eVGFXo6PHcwb ISs95wVlVttIog1q1oxp8dREmdZjDUeIdEaR9sWl7WJ7/N6zaEGyzRq6OAPm4u+LiczA 3PPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ZoloxK3yTzZJ7q8SM7DZ2NtN16ZQhni22ECVBpgehvY=; b=EPE+/sPqouvkbKeDImBT/IWgRLN9pZP2p64F7/9bdWEa9ddlm1F3SGtUP9PXgWlcnC o0D69myC+axUU+Pn9SVgVH7iErxYzVs76G22es8nwy6QOANj+8iI7I/mHes5QXRq9tXN zd3kLabXBojN6QOlrPW3Q8kLfM4gM0v+VK9ZUPi8r3eK2iz4sqlhOLjJIlF6G9p231KL pRMQVMEmFiQn8JVr+bGaE2GFImytVAPkX+WyqnAYN9snUNmHVjqTg5NXt6JE+v+UsfDx HpiE2vqrUr97o4ZA8n9rlk9Y1UHKgKBXJq2GlghxBxF8My4I/FrPfcRFEo9WFMAgrDIb GBJQ== X-Gm-Message-State: ALKqPweXKXIUcH3XCDRiUnHlN21GvhGma8TvbwLFUsX31DRUujygonlM Ggv+B39Oj0heaFZe5L84nV75OYup2+gKFjQTh8M= X-Received: by 2002:a9d:3387:: with SMTP id u7-v6mr535724otc.103.1527645455964; Tue, 29 May 2018 18:57:35 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:2451:0:0:0:0:0 with HTTP; Tue, 29 May 2018 18:57:35 -0700 (PDT) In-Reply-To: <1527575488-31305-1-git-send-email-nick.desaulniers@gmail.com> References: <1527575488-31305-1-git-send-email-nick.desaulniers@gmail.com> From: Nick Desaulniers Date: Tue, 29 May 2018 18:57:35 -0700 Message-ID: Subject: Re: [PATCH] blk-wbt: tracing: prefer strlcpy to strncpy To: "Steven Rostedt (VMware)" , Ingo Molnar Cc: Nick Desaulniers , Thomas Gleixner , Kate Stewart , Greg Kroah-Hartman , Philippe Ombredanne , Linux Kernel Mailing List , ebiggers@google.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 28, 2018 at 11:31 PM, Nick Desaulniers wrote: > Fixes a stringop-truncation warning from gcc-8. > > Signed-off-by: Nick Desaulniers > --- > include/trace/events/wbt.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/trace/events/wbt.h b/include/trace/events/wbt.h > index b048694..305252d 100644 > --- a/include/trace/events/wbt.h > +++ b/include/trace/events/wbt.h > @@ -33,7 +33,7 @@ TRACE_EVENT(wbt_stat, > ), > > TP_fast_assign( > - strncpy(__entry->name, dev_name(bdi->dev), 32); > + strlcpy(__entry->name, dev_name(bdi->dev), 32); > __entry->rmean = stat[0].mean; > __entry->rmin = stat[0].min; > __entry->rmax = stat[0].max; > @@ -67,7 +67,7 @@ TRACE_EVENT(wbt_lat, > ), > > TP_fast_assign( > - strncpy(__entry->name, dev_name(bdi->dev), 32); > + strlcpy(__entry->name, dev_name(bdi->dev), 32); > __entry->lat = div_u64(lat, 1000); > ), > > @@ -103,7 +103,7 @@ TRACE_EVENT(wbt_step, > ), > > TP_fast_assign( > - strncpy(__entry->name, dev_name(bdi->dev), 32); > + strlcpy(__entry->name, dev_name(bdi->dev), 32); > __entry->msg = msg; > __entry->step = step; > __entry->window = div_u64(window, 1000); > @@ -138,7 +138,7 @@ TRACE_EVENT(wbt_timer, > ), > > TP_fast_assign( > - strncpy(__entry->name, dev_name(bdi->dev), 32); > + strlcpy(__entry->name, dev_name(bdi->dev), 32); > __entry->status = status; > __entry->step = step; > __entry->inflight = inflight; > -- > 2.7.4 > Eric points out this doesn't initialize the rest of dest if src is less than size.