Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp242182imm; Thu, 12 Jul 2018 18:27:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpelciNhqNf1Og68tOxE2q+sfpGpY6hWw0f6B84Z3P8Qot4O3NhZBEfj0G3RGyFMXLKIoPK0 X-Received: by 2002:a17:902:8607:: with SMTP id f7-v6mr4364764plo.138.1531445271791; Thu, 12 Jul 2018 18:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531445271; cv=none; d=google.com; s=arc-20160816; b=QDiZJuARLAyEoRtifHFrw+/z7HUYLR6GhOUgUpEKN7XR1YisvCQRq/JuWwnkxEzLVt PV8DjwLeH4MLp4vbzRWx/Yg4f912efzpha/WZNhkEpJUYUHe6ktshkuLG0JDFG+DyE4K 8YGwHdWvYUEbECxFnKcCvG0Pg8OkurL6T+462djDpxTagvJCbOUtkJJ7ZXUAk/DOrFjh pIe7pzJI0IacP/UlCZQlKQCBZRG/caDRL/ohjWbzPMk2xd0ALmQGABJnqmqpeA7W6SMg VzK3LVfWCJVsJa6YxxmntJn1uaLMhpA0wR1RGVVRBaBk+N99ysFgWynpJyjnNKNsFc4P XtuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from:arc-authentication-results; bh=/XNfEsy2+j9VTnmjIG8+a+wsgBGumn5xE+athYAOH00=; b=exhYQGABby1GjJ1Dx/0rtqFEaqj3MISmgUR03CfLMQBTLiSc4dT+tO34EtYirm9sez su/Ef3PuTGq7RiwGxBGSq5rmDYdofDCKGZddarpJVpIv4vil2sMQUyuTBcQo3PNB+e1D CrvwIWX5i1pNAnDadUxWTrh8/B55xbRxtMHZAUIWZSz85mqauDYQoPf6Y+CvanrwJmi3 nXjq4b0OsC+9NDE9ftcGk9t2fBERMF3GodofXDq/WS4b39t8IhiQtmJNt0bFZ7LC5GQs wvweL0RdExGKudzTCB1Jn+FKiwZCF9KFPThTmevuJ2KFV4Rx8cubqYtUSs0gJ2etrJHB KY2Q== 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 k14-v6si8728982pga.149.2018.07.12.18.27.37; Thu, 12 Jul 2018 18:27: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 S2388142AbeGMBiO (ORCPT + 99 others); Thu, 12 Jul 2018 21:38:14 -0400 Received: from nautica.notk.org ([91.121.71.147]:43036 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387896AbeGMBiM (ORCPT ); Thu, 12 Jul 2018 21:38:12 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id 90250C029; Fri, 13 Jul 2018 03:25:59 +0200 (CEST) From: Dominique Martinet Cc: Dominique Martinet , Jason Wessel , Daniel Thompson , Arnd Bergmann , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 14/18] kdb_support: change strncpy+truncation to strlcpy Date: Fri, 13 Jul 2018 03:25:58 +0200 Message-Id: <1531445158-19731-1-git-send-email-asmadeus@codewreck.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1531444483-17338-1-git-send-email-asmadeus@codewreck.org> References: <1531444483-17338-1-git-send-email-asmadeus@codewreck.org> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/debug/kdb/kdb_support.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c index 990b3cc526c8..1f6a4b6bde0b 100644 --- a/kernel/debug/kdb/kdb_support.c +++ b/kernel/debug/kdb/kdb_support.c @@ -119,8 +119,7 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) * What was Rusty smoking when he wrote that code? */ if (symtab->sym_name != knt1) { - strncpy(knt1, symtab->sym_name, knt1_size); - knt1[knt1_size-1] = '\0'; + strlcpy(knt1, symtab->sym_name, knt1_size); } for (i = 0; i < ARRAY_SIZE(kdb_name_table); ++i) { if (kdb_name_table[i] && -- 2.17.1