From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 557B4C433FE for ; Tue, 4 Oct 2022 11:49:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xg8H6G27fxWKbV4SskQBko8h7F03Ra4OqGy/p9Bsz0I=; b=4Sx9Jv+7K2SBZN ur3P6RNXr7uX3XbllZuznoqk8SeMiURrfaO7VpSxeYORTuBQZejghsj51hhzwtJAvvp/DbyQ+3G04 F6vG5N5p//b1hwAWQiPAD08L5uPkuAAr67kPjPTtmrvmdYzeldiFgniPjOW5v0xl2jG+FUT9834Pt z7q/GZ/pZZ4X61STSYsith0NUVyKhWZKZi31SyaFhQoGdepw00AkPQoZcZ3pOcFhMs7DCBUyRB9Pi IwvB78lyBXkAUhnXQMAOYLeQBTdCdcWxhK4RRy+uNZmSp6pAPqwoDN6fx8p2KYcvnmt0J1rxiMJEc +Gnvx2F5ofPDrynMNR7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofgPY-009XaV-Nx; Tue, 04 Oct 2022 11:48:32 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofgPV-009XZa-ET for linux-arm-kernel@lists.infradead.org; Tue, 04 Oct 2022 11:48:30 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2FA7D613F8; Tue, 4 Oct 2022 11:48:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3584CC433C1; Tue, 4 Oct 2022 11:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664884105; bh=jVsr8vDY6btfVtvTcnIpc1i/LL+SGq9Q+ZvamuQM0GM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RXEVEkFNYLkprSJaZMK9wxbK0VreILO1l1TZVyG++VdCjqrVzAMlKIYpm+gudlW46 unMdKy4zgUQ6fgK/ao0bPd/rqHcAOrHr2dgWrFeTEhEg3pz6opH+DbSuiijVyWCP+O fms8tk1Wp36kZmkGfD/rY3Toa55gJpZcojOJ7IuDwJEONdEbQl4LPEiJEb0MGmM3nb t8Be7NWHGM5GiafTFuGibkKqm4Z+HvDJNEHCoZSA0f27++2gQWibJvr33NK08T3hHW TiMCDj40QQWzbQCowJQ51fE1hqtJqlbCNdWvKJNZWY1+1Tzstnb05+Aph9JrU3irjo 8YYALxcJUP4Tg== Date: Tue, 4 Oct 2022 12:48:19 +0100 From: Will Deacon To: xu.panda668@gmail.com Cc: catalin.marinas@arm.com, broonie@kernel.org, maz@kernel.org, kristina.martsenko@arm.com, vladimir.murzin@arm.com, mark.rutland@arm.com, ardb@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, cgel.zte@gmail.com, Xu Panda , Zeal Robot Subject: Re: [PATCH linux-next] arm64/idreg: use strscpy() is more robust and safer Message-ID: <20221004114818.GA23663@willie-the-truck> References: <20220929072905.282639-1-xu.panda668@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220929072905.282639-1-xu.panda668@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221004_044829_565009_10C7F87A X-CRM114-Status: GOOD ( 16.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 29, 2022 at 07:29:06AM +0000, xu.panda668@gmail.com wrote: > From: Xu Panda > > The implementation of strscpy() is more robust and safer. > That's now the recommended way to copy NUL terminated strings. > > Reported-by: Zeal Robot > Signed-off-by: Xu Panda > Signed-off-by: Xu Panda > --- > arch/arm64/kernel/idreg-override.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c > index 95133765ed29..61bbec7ef62e 100644 > --- a/arch/arm64/kernel/idreg-override.c > +++ b/arch/arm64/kernel/idreg-override.c > @@ -246,7 +246,7 @@ static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) > return; > > len = min(len, ARRAY_SIZE(buf) - 1); > - strncpy(buf, cmdline, len); > + strscpy(buf, cmdline, len); > buf[len] = 0; Aren't we terminating the buffer explicitly here anyway? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel