Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 570BFC433C1 for ; Mon, 22 Mar 2021 13:14:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 105C66191D for ; Mon, 22 Mar 2021 13:14:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232508AbhCVNOF (ORCPT ); Mon, 22 Mar 2021 09:14:05 -0400 Received: from smtp-fw-9103.amazon.com ([207.171.188.200]:7998 "EHLO smtp-fw-9103.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231971AbhCVNLu (ORCPT ); Mon, 22 Mar 2021 09:11:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1616418709; x=1647954709; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=zOwbymHIq1hP9KuK7H4nChZsMNjtDojKcxzsEmxBCBE=; b=rFkYVdRSMk79dWWeFOQctb4WQmOyGioHrPfjx7Ejpt2VcCo+iETHZpMl 8/oyBOPeZA7fZzHIu9TTXwrLmlY+qmDm0KrY2BGDUb4dXRopfIcKA3izj PFQacyAr9Fjq46+R6k8f6HxRqpJDN4xiRppxDxO1BJKMTLk7X0TwC2QuR U=; X-IronPort-AV: E=Sophos;i="5.81,268,1610409600"; d="scan'208";a="920615495" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2b-8cc5d68b.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-9103.sea19.amazon.com with ESMTP; 22 Mar 2021 13:11:41 +0000 Received: from EX13D19EUB003.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2b-8cc5d68b.us-west-2.amazon.com (Postfix) with ESMTPS id B30C6A071B; Mon, 22 Mar 2021 13:11:40 +0000 (UTC) Received: from 8c85908914bf.ant.amazon.com (10.43.161.55) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 22 Mar 2021 13:11:37 +0000 Subject: Re: [PATCH for-next] RDMA/efa: Use strscpy instead of strlcpy To: Jason Gunthorpe CC: Doug Ledford , , Firas JahJah , Yossi Leybovich References: <20210316132416.83578-1-galpress@amazon.com> <20210322130131.GC247894@nvidia.com> From: Gal Pressman Message-ID: Date: Mon, 22 Mar 2021 15:11:33 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210322130131.GC247894@nvidia.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.43.161.55] X-ClientProxiedBy: EX13P01UWA004.ant.amazon.com (10.43.160.127) To EX13D19EUB003.ant.amazon.com (10.43.166.69) Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On 22/03/2021 15:01, Jason Gunthorpe wrote: > On Tue, Mar 16, 2021 at 03:24:16PM +0200, Gal Pressman wrote: >> The strlcpy function doesn't limit the source length, use the preferred >> strscpy function instead. > > Why do we need to limit the source length here? Either this is a bug > because the source string is no NULL terminated or it is OK as is? It's not a bug as is, but it addresses checkpatch's warning: WARNING: Prefer strscpy over strlcpy - see: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/