Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp912090imm; Fri, 13 Jul 2018 08:20:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfj/Tp/U0p/qmpSCAdZcoxG0QHgeu4TK1xSi+jZzfWfgAubfI2tycThiKpd6eoAMHq4KtQ2 X-Received: by 2002:a62:4bc6:: with SMTP id d67-v6mr7466229pfj.175.1531495211952; Fri, 13 Jul 2018 08:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531495211; cv=none; d=google.com; s=arc-20160816; b=NmePNzk5NX86SGxXRyRpHpshY5dqHjMNDfuzW2MbrEX8qbZemV2CRQmH7dlmlzCb5T fmQ+ZMwWohSk0T4C3PyXkhVaPVmGXCwkpm5BcOfHngUHoxZ7UiylHrwb2B94JhOWUe86 TF9nU7xAnA2AJ4miZnklzH9s6hx+uq4QWJiZrjpjSl5z4RJES26vBsfUdBue8Dl1IzVm EMpzJA2lq/ODtoVQi7JvkLmMGbmRecRexlQS5YRmyLKTZ+ldvSadU2JyqCrCv16dGtM1 Cg37ApLU/fmd0oe8NraSt9DlOgJ1b4odrbTg7PrsC8hlQz8mJggj4wFzjRs4/8zndAgb CtQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=rba0gj+GyIMhRBGc1fCy/4yXlBN+IjGLHOV+TUebaR8=; b=p1dC6BRoo21l7ghA1jbSV7d9/QMk/vPZTdZE83kY0nwi5L2lwfz063xi11AfTay1H7 GV27HFEM0vX78y1rb9QAUUY3w4Mw8NTLU82nSbL54g5ivPBBmEutxKGJX6rmdRuMpPlR 14a3FuWuF8bWUnRsXcRADYhLDoFtqKhB5iHnh96zWKa6EM3GN7yMBJJrh6F30R7OWJib JhBhSFO2BjyWJ9ewRC/boCpOBeKiwPxmzZLdswJixqcXf06ER7/+/WM6vkFwzAETdCj+ bgmRZOtFCGgwI7bc2WY3/0sG1naU2+Cm3p+EoJHQAZwYB4JmTSGxoFtvzqAEDThhmFlU ZpIA== 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 i20-v6si23081810pgb.547.2018.07.13.08.19.52; Fri, 13 Jul 2018 08:20:11 -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 S1730017AbeGMPeM (ORCPT + 99 others); Fri, 13 Jul 2018 11:34:12 -0400 Received: from nautica.notk.org ([91.121.71.147]:58792 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729736AbeGMPeM (ORCPT ); Fri, 13 Jul 2018 11:34:12 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id BA8FFC009; Fri, 13 Jul 2018 17:19:06 +0200 (CEST) Date: Fri, 13 Jul 2018 17:18:51 +0200 From: Dominique Martinet To: Daniel Thompson , David Laight Cc: Jason Wessel , Arnd Bergmann , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH 14/18] kdb_support: change strncpy+truncation to strlcpy Message-ID: <20180713151851.GA14190@nautica> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <93d3ace9a35b4436930ed0521127c12b@AcuMS.aculab.com> <20180713103321.thjpohla6fuszona@holly.lan> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Daniel Thompson wrote on Fri, Jul 13, 2018: > On Fri, Jul 13, 2018 at 03:25:58AM +0200, Dominique Martinet wrote: > > Generated by scripts/coccinelle/misc/strncpy_truncation.cocci > > > > Signed-off-by: Dominique Martinet > > It would have been good for you to mention in the changelog how > you reviewed your change to verify that the extra zero padding > from strncpy() isn't required. I'm sorry, I went a bit too fast with the send-email button on this path series; I agree it is lacking. > However... I have taken a look and can't see any problem so: > > Reviewed-by: Daniel Thompson Thank you for the review, I will update the commit message with more details and change strlcpy to strscpy in a v2 David Laight wrote on Fri, Jul 13, 2018: > > - strncpy(knt1, symtab->sym_name, knt1_size); > > - knt1[knt1_size-1] = '\0'; > > + strlcpy(knt1, symtab->sym_name, knt1_size); > > You'd be better using strscpy() not strlcpy(). > The return value of strlcpy() is the length of the source string. > If the source string isn't '\0' terminated horrid things happen. I was suggested to use strlcpy for drm and didn't realize this at this point, but you are correct; strlcpy is far from being as protective. I'll update the coccinelle patch to use strscpy and resend this. > David > > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, > MK1 1PT, UK > Registration No: 1397386 (Wales) > > P Please consider the environment and don't print this e-mail unless > you really need to (By the way, your e-mail client sends both html and text, but the text version only included the footer so my mail client, which prefers text, was displaying an empty mail message. If possible I would appreciate if you could disable either version so as to get a coherent message) -- Dominique Martinet