Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp925448rwb; Thu, 18 Aug 2022 15:03:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Fx6/F3IKpMQUSNv2i6b+Ts8FHYOysCRVx4YkzHxCpjpZ7XarS6EAcUwuL/o4XEvAWNXtc X-Received: by 2002:a17:90b:1d84:b0:1f5:b66:7460 with SMTP id pf4-20020a17090b1d8400b001f50b667460mr10849538pjb.50.1660860230712; Thu, 18 Aug 2022 15:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660860230; cv=none; d=google.com; s=arc-20160816; b=Y0+KEr26sRRodgVnSrQefk9om5n8zPsfSdM/sn3PqnHX9eX3+KCE5agM2fGPdUJwGY 4RzuMnmKZCXJnKMbWGAouodHGFn3+JZRy6TkeJhzsQTfF1op6oxTQYKDProWEhAu4k1/ pgRouz55lgwvmnmCFpJnyirPgqLDseqfcAZWfvJ123PYe1aJB5byN9BQ/3Q7bbbhcebr JYYcV+lKa6oJJkLjxIhRqNrxwGGUgVqrFcTODZL1E44KYuX0w28xYvhJwhHn99xmz4uB TWhkHK5ewEQtAIHyx+D73EVCQfkiOm8Ruz6Vh1L1CU2tedK9eIBZYlfqpwa3WDP/NTag y4PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=f88+DHkqVNgwqC0ZAnpH/iTT+J8x50s4TYYlqoMHZQ4=; b=LFzb9IhRrQFzm66y7lkWppYWOKag4mqu/TriWkYhDYLn49zlBvUGlwHizV0jKjFSvI a1dQrcEA8DFOvZabLIW/OgX7Y0xVNwoL4ZLCzhUZUOstEGW6DV+20giBhWmAdxjAZTSX NxPm+C4vo6rQU1BAayits54K1GLftm/gWI+n3amaVoH4THdZdV7rZFD3CjpIQoSAxF09 p5yUTvT4r4OCfTtO2o67458Ti6iyrWyK8nT5bhK9TVYhFfglOYy0RLdMuypMnfAS7QMq BwEUSlH/7Xvg2KRzy2ExPZaKyjFXHFV/OK5q+LYivlEFa94RNrI105VawiMpAbDg1a8F UNDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=gdxta6iG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t1-20020a170902e84100b0016dbc1467f0si2446923plg.148.2022.08.18.15.03.39; Thu, 18 Aug 2022 15:03:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=gdxta6iG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346599AbiHRVJu (ORCPT + 99 others); Thu, 18 Aug 2022 17:09:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346602AbiHRVJI (ORCPT ); Thu, 18 Aug 2022 17:09:08 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC819D39A2 for ; Thu, 18 Aug 2022 14:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=k1; bh=gdwMVn08U0Xy1O 0ChHwkhYVnApy2tDKyoBT757de7NE=; b=gdxta6iGx7Uc4I/oV9LejgZ99B5mcd PFNWdgtE4wTl3W2RA4mrCtaZciN8jhCWb/sFyeb6iM7yiTK7RkBOzymkEdtofb0v WBz1G16tIq9ZBNDZ9SyMCkweP9WSUrLWaLN22gBe7eZYXbqRcWcEYSkzxnPIjQgz +Oi+8ms+iq4Es= Received: (qmail 3961932 invoked from network); 18 Aug 2022 23:01:26 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 18 Aug 2022 23:01:26 +0200 X-UD-Smtp-Session: l3s3148p1@MynhSIrmBb4ucref From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , linux-fsdevel@vger.kernel.org Subject: [PATCH 03/14] proc: move from strlcpy with unused retval to strscpy Date: Thu, 18 Aug 2022 23:01:12 +0200 Message-Id: <20220818210123.7637-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220818210123.7637-1-wsa+renesas@sang-engineering.com> References: <20220818210123.7637-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang --- fs/proc/kcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index dff921f7ca33..9f61d5d405f5 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -422,7 +422,7 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) char *notes; size_t i = 0; - strlcpy(prpsinfo.pr_psargs, saved_command_line, + strscpy(prpsinfo.pr_psargs, saved_command_line, sizeof(prpsinfo.pr_psargs)); notes = kzalloc(notes_len, GFP_KERNEL); -- 2.35.1