Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3059990imm; Mon, 28 May 2018 23:38:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpTcfrZG7COvfbR27YzUFVCW1pbcYRtVHhVpF2Qi2b2J2czs+Cz08gHGspe1ADJVVLwafh5 X-Received: by 2002:a63:9541:: with SMTP id t1-v6mr12507712pgn.77.1527575926745; Mon, 28 May 2018 23:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527575926; cv=none; d=google.com; s=arc-20160816; b=Hbxq0coqEAE5Ohs2vwj4BoVdffKuLbR5Uf3hPNelck2QSyPq+m8Agd40R8J4591A7c TS2UJopCdDRppTvZDCr5jcVs3YyFVMHYYNFqP3Z93N1BFetNb1CN/sY+a44tGwzkT9Z8 PLoXvFLwAOH/Cu6j76fLtWEXGIyERelPsS05+N/GdH71Obw97/KcoA9i2PBQs7PHpPwq 93d7QwYSqO21kfnCdAciCad1o6/DF8DmDA+9HdITXOTNyq9EMcqriBfmg0PBGX6Pnkoz My1ZuxJle298LQboN95wZGmApA2YxSYOP4mXFcEzekxNi0nudUmwinTevQY87QxMpfEh Vw+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=DOljlIgrsJ907kU0nESg5AqStAKZnU5lcb8Ep1ST2CU=; b=io0PmjQcpgxAXh4UvxEVXf1XrlU+3uBabjojUkCrlnFvVqg89mPLI/pJQpmzfBSycv wzupTOXIsn5MTNzd6WtSFG4CJ+R84jIfvFHf+f1IVCWdkcVevOoGMKkMQ4ErKqT8WJ2w hWdWxuMYW2Kvfv5m9z7+UeBvPhj4VSDXzGYRrQPmlh06lGLtekNXmDL7kvjbwGXaX432 Ob6HSgYBz/euNpVb08+79tqtikVXx5sbI1CEyC0Id/DYu1JU4XR/qwxQIQ+10MTwCZjD MSoFx3hRzZLhpXIeVJ5XCj5x0Uz7IVoWJsWQdkECJvTATqTWQecsr8S70FJweB2yILzZ m11w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JxaXpizq; 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 b96-v6si32624337pli.172.2018.05.28.23.38.32; Mon, 28 May 2018 23:38:46 -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=JxaXpizq; 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 S1754579AbeE2GiA (ORCPT + 99 others); Tue, 29 May 2018 02:38:00 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:42437 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751800AbeE2Gh5 (ORCPT ); Tue, 29 May 2018 02:37:57 -0400 Received: by mail-pl0-f68.google.com with SMTP id u6-v6so8368731pls.9 for ; Mon, 28 May 2018 23:37:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=DOljlIgrsJ907kU0nESg5AqStAKZnU5lcb8Ep1ST2CU=; b=JxaXpizqhCJMtd4n3fEuIQoQLYRAs1Ltk8iwIBH4IFwKPpPxS2U+ODGsJ+hnxc2v6L GRKNjFWyVF7W0qaeLgI1ROTNIappEzQvHV3qZPejVgWzZGAxfctUX56rPPYzKeaFRK1f opGmEWHQFBz8HYjfnoam3aMIc6PoHXjGpf6V1GjA9Bh33GvlBtvJA/1I6vLb0qeB4dze LLEmeiT4Pbt4saUl8QKxxeyoD+MpQYFrgsXh7HmsVuTMyisGelshiqo6SliERimvwYl/ nBiXjDsETF+onRl9gpuKyZCta4sUVv0fM+AqpYZgsEDB8stou3sMdNEcow8DH8+LFaqV EKyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DOljlIgrsJ907kU0nESg5AqStAKZnU5lcb8Ep1ST2CU=; b=M7YMhaf9nSXOEUJbGXh8SRuVkhGR12vtZDpsdaE0c5jeueVsEvYC/H1dhkiKjIBHrm Re6MSgMXkiarL33H4F1D+4xo/eZZO9t9DYS6huQhLYWAiqyqFP7TVIDjizt6NdSnkwPJ FYqFAVYnrxD4O3uPiGvBU3xHEsekzyQaeMIKLGVOvWlMpXRGLLcBpAhlY+AJ1pkhs/iy aZ1etMmaYbugpfuGkKoePAqhWleZEWplln7+WZ7IR8Q8WJoAW3+Aa4flkzBeErf+nZxX 20bdsvZIgvictmHRSGblpprceXNFjuA8sLMuTRyOOnpuLc9Q9+5EjTCo14jICYf1h7MO fXgw== X-Gm-Message-State: ALKqPwd+MUAo23WlxedDSOuN+nV9reb8rlhIcLWIT2pbttgIca7DgMXH J9WIvp+Cq9HRbpaUrk/pEQQ= X-Received: by 2002:a17:902:8491:: with SMTP id c17-v6mr10357580plo.97.1527575876624; Mon, 28 May 2018 23:37:56 -0700 (PDT) Received: from localhost.localdomain (c-24-6-183-110.hsd1.ca.comcast.net. [24.6.183.110]) by smtp.googlemail.com with ESMTPSA id n10-v6sm73980975pfk.145.2018.05.28.23.37.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 May 2018 23:37:55 -0700 (PDT) From: Nick Desaulniers To: rostedt@goodmis.org, mingo@redhat.com Cc: Nick Desaulniers , Greg Kroah-Hartman , Jens Axboe , Thomas Gleixner , Philippe Ombredanne , Shaohua Li , linux-kernel@vger.kernel.org Subject: [PATCH] writeback: tracing: prefer strlcpy to strncpy Date: Mon, 28 May 2018 23:37:47 -0700 Message-Id: <1527575868-4156-1-git-send-email-nick.desaulniers@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixes a stringop-truncation warning from gcc-8. Signed-off-by: Nick Desaulniers --- include/trace/events/writeback.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index 32db72c..cfaf57d 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h @@ -66,7 +66,7 @@ TRACE_EVENT(writeback_dirty_page, ), TP_fast_assign( - strncpy(__entry->name, + strlcpy(__entry->name, mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32); __entry->ino = mapping ? mapping->host->i_ino : 0; __entry->index = page->index; @@ -96,7 +96,7 @@ DECLARE_EVENT_CLASS(writeback_dirty_inode_template, struct backing_dev_info *bdi = inode_to_bdi(inode); /* may be called for files on pseudo FSes w/ unregistered bdi */ - strncpy(__entry->name, + strlcpy(__entry->name, bdi->dev ? dev_name(bdi->dev) : "(unknown)", 32); __entry->ino = inode->i_ino; __entry->state = inode->i_state; @@ -176,7 +176,7 @@ DECLARE_EVENT_CLASS(writeback_write_inode_template, ), TP_fast_assign( - strncpy(__entry->name, + strlcpy(__entry->name, dev_name(inode_to_bdi(inode)->dev), 32); __entry->ino = inode->i_ino; __entry->sync_mode = wbc->sync_mode; @@ -220,7 +220,7 @@ DECLARE_EVENT_CLASS(writeback_work_class, __field(unsigned int, cgroup_ino) ), TP_fast_assign( - strncpy(__entry->name, + strlcpy(__entry->name, wb->bdi->dev ? dev_name(wb->bdi->dev) : "(unknown)", 32); __entry->nr_pages = work->nr_pages; __entry->sb_dev = work->sb ? work->sb->s_dev : 0; @@ -274,7 +274,7 @@ DECLARE_EVENT_CLASS(writeback_class, __field(unsigned int, cgroup_ino) ), TP_fast_assign( - strncpy(__entry->name, dev_name(wb->bdi->dev), 32); + strlcpy(__entry->name, dev_name(wb->bdi->dev), 32); __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); ), TP_printk("bdi %s: cgroup_ino=%u", @@ -296,7 +296,7 @@ TRACE_EVENT(writeback_bdi_register, __array(char, name, 32) ), TP_fast_assign( - strncpy(__entry->name, dev_name(bdi->dev), 32); + strlcpy(__entry->name, dev_name(bdi->dev), 32); ), TP_printk("bdi %s", __entry->name @@ -321,7 +321,7 @@ DECLARE_EVENT_CLASS(wbc_class, ), TP_fast_assign( - strncpy(__entry->name, dev_name(bdi->dev), 32); + strlcpy(__entry->name, dev_name(bdi->dev), 32); __entry->nr_to_write = wbc->nr_to_write; __entry->pages_skipped = wbc->pages_skipped; __entry->sync_mode = wbc->sync_mode; @@ -372,7 +372,7 @@ TRACE_EVENT(writeback_queue_io, ), TP_fast_assign( unsigned long *older_than_this = work->older_than_this; - strncpy(__entry->name, dev_name(wb->bdi->dev), 32); + strlcpy(__entry->name, dev_name(wb->bdi->dev), 32); __entry->older = older_than_this ? *older_than_this : 0; __entry->age = older_than_this ? (jiffies - *older_than_this) * 1000 / HZ : -1; @@ -583,7 +583,7 @@ TRACE_EVENT(writeback_sb_inodes_requeue, ), TP_fast_assign( - strncpy(__entry->name, + strlcpy(__entry->name, dev_name(inode_to_bdi(inode)->dev), 32); __entry->ino = inode->i_ino; __entry->state = inode->i_state; @@ -657,7 +657,7 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template, ), TP_fast_assign( - strncpy(__entry->name, + strlcpy(__entry->name, dev_name(inode_to_bdi(inode)->dev), 32); __entry->ino = inode->i_ino; __entry->state = inode->i_state; -- 2.7.4