Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp27772ima; Thu, 14 Mar 2019 18:38:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzyqZpwg9dKH4zpQF5Gkx6F1FJl85urlOR9LGqjOcF7hoU8t+TcLAytbeeVjD1YRzuCTDrj X-Received: by 2002:a62:57d7:: with SMTP id i84mr1347842pfj.125.1552613931325; Thu, 14 Mar 2019 18:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552613931; cv=none; d=google.com; s=arc-20160816; b=o0mhFEb0/xG3WjcMLAXVAMFEGX1DXX2S71D2a8APFqjrUy5sgq2DoZJjrA3FM19Q6l KlxuwCn3Q9eCx6dKvDBhSmdJsAd5RtzZR2MZB88NdOkZ6grgDNPCtM3NXkQQpUFQiM5T LYfj7qzosEAI22tBqmpsIHBAk/vNET3fC9o5PsQ4ZDB761dWqW+Q+GepDJRXEM8E/IxN QaL8P0GVvEd1SLeXUlztSBqJckydcrdEvnGvdOgshczaUQpFmjpoUpGpbhUvMcYUZAYa dNTfej5vcjexfd1iJcO49pO6O7q14V/iqHE+r4MGGLLosIXwM29xySTSW5c1nzxPnNu8 L1Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=/n9yrDfaPfv/wX6Ncy+0pHYsL3H+iYVC5PnJd98k5wg=; b=UtWrveEFc9qw4spdwSaYzxfeArfob+2WMz1y0fXdW4LV7WUgK4oHkE+zSVxH+SmC53 9AWpMbR4Afp0xTO+NlCzTVTGdHGirsiv4BL6M9fZy7LROp9BLVL76KQpyWTInKtmy9CK 6QcgzLfeJ52pOPMdwoPzxNMGv7KsidUd/WMzhtiXYIJpPeaMfqHsYZOT9Ip7poMC6Iqb K+PQdEPgxvd5PQHupBVWIFpg9Mr8QEoFHf3/qz8V5M3ZIAusQqIbwrCAKxMyLYpv/fs/ zYwbjGlSZYTjRU+OSQdv69bquK3aWR9nLNcXxM3y2jsU7rAMnwOBde5971/6HHE8WNfF S/CQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v7si599300pgq.125.2019.03.14.18.38.23; Thu, 14 Mar 2019 18:38:51 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728109AbfCOBhY convert rfc822-to-8bit (ORCPT + 99 others); Thu, 14 Mar 2019 21:37:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:45872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727284AbfCOBhY (ORCPT ); Thu, 14 Mar 2019 21:37:24 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9160D21872; Fri, 15 Mar 2019 01:37:23 +0000 (UTC) Date: Thu, 14 Mar 2019 21:37:21 -0400 From: Steven Rostedt To: Jens Axboe Cc: Dominique Martinet , Ingo Molnar , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 15/18] blktrace: change strncpy+truncation to strlcpy Message-ID: <20190314213721.339979f0@oasis.local.home> In-Reply-To: <1531445162-19771-1-git-send-email-asmadeus@codewreck.org> References: <1531444483-17338-1-git-send-email-asmadeus@codewreck.org> <1531445162-19771-1-git-send-email-asmadeus@codewreck.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jens, I noticed this old patch in my inbox. It looks like a legit cleanup. Want to take it? -- Steve On Fri, 13 Jul 2018 03:26:02 +0200 Dominique Martinet wrote: > Using strlcpy fixes this new gcc warning: > kernel/trace/blktrace.c: In function ‘do_blk_trace_setup’: > kernel/trace/blktrace.c:497:2: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation] > strncpy(buts->name, name, BLKTRACE_BDEV_SIZE); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Generated by scripts/coccinelle/misc/strncpy_truncation.cocci > > Signed-off-by: Dominique Martinet > --- > > Please see https://marc.info/?l=linux-kernel&m=153144450722324&w=2 (the > first patch of the serie) for the motivation behind this patch > > kernel/trace/blktrace.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c > index 987d9a9ae283..2478d9838eab 100644 > --- a/kernel/trace/blktrace.c > +++ b/kernel/trace/blktrace.c > @@ -494,8 +494,7 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, > if (!buts->buf_size || !buts->buf_nr) > return -EINVAL; > > - strncpy(buts->name, name, BLKTRACE_BDEV_SIZE); > - buts->name[BLKTRACE_BDEV_SIZE - 1] = '\0'; > + strlcpy(buts->name, name, BLKTRACE_BDEV_SIZE); > > /* > * some device names have larger paths - convert the slashes