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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93466ECAAD6 for ; Fri, 26 Aug 2022 06:16:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232033AbiHZGQ1 (ORCPT ); Fri, 26 Aug 2022 02:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230517AbiHZGQ0 (ORCPT ); Fri, 26 Aug 2022 02:16:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 015985A831; Thu, 25 Aug 2022 23:16:25 -0700 (PDT) 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 0748561B1D; Fri, 26 Aug 2022 06:16:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02DADC433C1; Fri, 26 Aug 2022 06:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661494583; bh=12HUni1vNh+fFGIt+vHYF+GjFpAxFGKd2sLTQRVhsoI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hR9oroQ9BbyEEMYAHm7W/hXPZNAz/6VL0hrkDZmXJ4PYQNGPzNLiCdwVoBHYnEtz0 gPBDrXtoj+brM4l4i7hNhhsyMIYEs/c5nksEwelUk3V0aN4FdC9Nq1Nx7hWzFv4S1I Exbr3Y+ljCvM0/5Ri/4lT/W/U5IIt4BOnz/rgxQoOw4VAVI4Rd/q6M7r5jBQQr5m4o jCedCbW8tQeCprgoJ853+fmdAs71OOAdZsSs9g0z4tjOfJL13iIlUj/8FF18FKQfTk 9UBwp7RvZ4yAMm0cnVZdqpCuIQpgSW1BuGZhPoA6Aly0XWibc+oM7Owuzjv3iner0q YcUtmWiqEmBOw== Date: Fri, 26 Aug 2022 09:16:16 +0300 From: Jarkko Sakkinen To: Wolfram Sang Cc: linux-kernel@vger.kernel.org, David Howells , Paul Moore , James Morris , "Serge E. Hallyn" , keyrings@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH] security: move from strlcpy with unused retval to strscpy Message-ID: References: <20220818210232.8707-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220818210232.8707-1-wsa+renesas@sang-engineering.com> Precedence: bulk List-ID: On Thu, Aug 18, 2022 at 11:02:31PM +0200, Wolfram Sang wrote: > 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 > --- > security/keys/request_key_auth.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c > index 41e9735006d0..8f33cd170e42 100644 > --- a/security/keys/request_key_auth.c > +++ b/security/keys/request_key_auth.c > @@ -178,7 +178,7 @@ struct key *request_key_auth_new(struct key *target, const char *op, > if (!rka->callout_info) > goto error_free_rka; > rka->callout_len = callout_len; > - strlcpy(rka->op, op, sizeof(rka->op)); > + strscpy(rka->op, op, sizeof(rka->op)); > > /* see if the calling process is already servicing the key request of > * another process */ > -- > 2.35.1 > Acked-by: Jarkko Sakkinen BR, Jarkko