Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3746355rwl; Tue, 27 Dec 2022 14:33:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXsFanlEXz5wwotLC4LKF4Vpmc7AB2fTMYm7t2WUv4Tweho32pJb3nwNgPzy5C/CefzeGBIN X-Received: by 2002:a17:907:6ea9:b0:7c0:e7ad:5296 with SMTP id sh41-20020a1709076ea900b007c0e7ad5296mr24538473ejc.55.1672180405050; Tue, 27 Dec 2022 14:33:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672180405; cv=none; d=google.com; s=arc-20160816; b=XaRdepXci+XgbwEuvL+jc5ypnizQ2TP3x2nGMEMD0Y9Ye17X597a+lrqKk8kA4M4qi BXMfG1zCgooX3mJwIxXbpqJnsTe75hHz+CX9Uz8gTIda1ZzA02/kZloeuCwporCErNpp EDyuImKxhTO3h/nd3DyhOnshS5ncuRdDKoVevInInxYA5UDoAx1mst4QjwDhnaLDvT9e aOhaZU3tVbJAS9E5zf82ICDrPa+yWnndzvVwVQ5y7VoiztWy8XzokFdnEr10nmmJ1Gpm iaBTo8NtZ/pGnF5Z6gvpGLm8wjsCQqY15g002g3J+BIGKtz7maqooFF+KxGDHHxoTt3U BS+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=+VByUZ+UjZnv5ZjnaDuaL7SWVKjeRQgPGmY1SuKtkEE=; b=Uc5AQ4oVTEKEsjST6I0R2vLsFNJZsaSnHpHDZkBDA5gIxCfUJ5Fnp/5nBsWpM+f1T4 hD/59363eRkA8uvf4z4Cz5Vv6KvlF0YU1uC4bTMw7v/VI5wZgZGEEcg/8Bn9H6PLCgMK g2jRfIbFUbd/r8LkTknPIvxQkA8A+vJksWoQHuNumVtgn3ING7VH6YI6/kMVpTCsANdl YLcHmFG49Cf5I81EG0AbFE0fz8JG8fSOxg4v7Bc1odjGZA/c+L4DTzcrKaFz96owhjs5 gVyT4k0gYh+4fMsp6VsllO29U0gBJ8Pqc3ZdQHI71LfovcgPVHfOz17E4hkvjxEhbJoy 6grg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=qB5clFHj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f9-20020a056402354900b004772b115406si13556886edd.560.2022.12.27.14.33.09; Tue, 27 Dec 2022 14:33:25 -0800 (PST) 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=pass header.i=@gmx.de header.s=s31663417 header.b=qB5clFHj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbiL0VbV (ORCPT + 67 others); Tue, 27 Dec 2022 16:31:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbiL0VbU (ORCPT ); Tue, 27 Dec 2022 16:31:20 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B77325C9; Tue, 27 Dec 2022 13:31:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1672176637; bh=56htlLHUcU+qWeQhLbsL8ptRSB512sH1ur2RjROHFv0=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=qB5clFHjXX3d/b6Lzf83twSzJQdvGjWD2S7wFGPaBic5eUBqTl5R/xovKgNaMKain RFpPO2PH6GzAewmyOJ2AU6JfJ81NLrtsuukOiVHMPzZx367lYgpYTvJU72yLjB3xk9 6Ci4gd9EyieOj7q5Wu8VSponmwu9zBoXaO/98f2g9TTAbCQeKh5kxz+2VGX0fHj/R7 TcBCMgXmC+VXx9jyK3XuwqNcS7cntKyc3eUrbuLsVrmKJJGXl4H9xa0T/Qh9VR+M36 BnPvYR3eh+vk5HDMKzGQumlN4iFeCsbwl+7v+t2Cy8kbyFFj2vMQ6eyYOKGbPmfpM0 5Jtfa0Za17nxA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.20.60] ([92.116.190.3]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mq2jC-1oWFfa3l4M-00nAgK; Tue, 27 Dec 2022 22:30:36 +0100 Message-ID: <1d0def42-11b7-0039-368d-d355f348767c@gmx.de> Date: Tue, 27 Dec 2022 22:30:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH linux-next v2] parisc: use strscpy() to instead of strncpy() Content-Language: en-US To: Rolf Eike Beer , james.bottomley@hansenpartnership.com, yang.yang29@zte.com.cn Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, xu.panda@zte.com.cn References: <202212261840048448622@zte.com.cn> <2298026.kkTNVCUfUN@daneel.sf-tec.de> From: Helge Deller In-Reply-To: <2298026.kkTNVCUfUN@daneel.sf-tec.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:fzFzyXibYGlFunT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ZoC34/ihXfcSSRrxKmrLI9MVd6mnkcvvdDiqkI8GhkWNK5Wib2hXflS4kzNCIV3o565 M19UuEle6TSoqckkfzKfIHomGxHbtjBH3ATURchk0CCg2WJ/7v1cEqrvpay1emH1BAGfcj4U9 uKEEH/ZBdTd23FzCSkZaMd79pg8= X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On 12/27/22 08:47, Rolf Eike Beer wrote: > Am Montag, 26. Dezember 2022, 11:40:04 CET schrieb yang.yang29@zte.com.c= n: >> From: Xu Panda >> >> The implementation of strscpy() is more robust and safer. >> That's now the recommended way to copy NUL-terminated strings. >> >> Signed-off-by: Xu Panda >> Signed-off-by: Yang Yang >> --- >> change for v2 >> - sizeof(in) is better and simplified, thanks for Helge Deller. >> --- >> drivers/parisc/pdc_stable.c | 9 +++------ >> 1 file changed, 3 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c >> index d6af5726ddf3..d3075445260b 100644 >> --- a/drivers/parisc/pdc_stable.c >> +++ b/drivers/parisc/pdc_stable.c >> @@ -274,8 +274,7 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, >> const char *buf, size_t coun >> >> /* We'll use a local copy of buf */ >> count =3D min_t(size_t, count, sizeof(in)-1); >> - strncpy(in, buf, count); >> - in[count] =3D '\0'; >> + strscpy(in, buf, sizeof(in)); > > What is "count" now needed for? Looks like a write only variable at leas= t in > these hunks. isn't count the return value? Helge