Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp18520ybj; Fri, 8 May 2020 05:38:10 -0700 (PDT) X-Google-Smtp-Source: APiQypIOtqQCuBViIzJyU5FCxFgzF/Eub5EVBjRt0RArzMb90r+Ozv+3eHaqj5s4MWoGz+SiFGFn X-Received: by 2002:a50:bb07:: with SMTP id y7mr1924922ede.358.1588941490766; Fri, 08 May 2020 05:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588941490; cv=none; d=google.com; s=arc-20160816; b=zm2ujJuIA4Ml5AAR/A3m6chw2eDAWjXBuWvq25SGJqqYXvAQmGbwn60uuQBCJJyjkz ExZbE1WbG0H/Yu9KxcPoaz4MNrLKGxgGjriJ31IxonC5pe8T9Ao1QMy3/U6nV1Fzhde3 Qs5FIr7ckLKECitjNydqUtxi6FZ+xUuJ3am0YsaJkTDeKaCz+jE8h2TcYxn2qMBX/dPb yjbInT4XngLHCj/CNXky/F124tYx3zO43zU3ufNmz9jU45wvWFr+okxdKTJXt9/C8RaH ardOsjkPFPi9r1wDKqI8rkMU6xSfJQ84NRxW7MQPLkn8qPyicwH5oY77YLfXcPKX6e79 Pf3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=etPqNbA3TbjVvFKjwCopyhMZHfp779jhg6JU8gTvGJM=; b=LhbQxe39O8Mhg39I9T1VU95OzWLgAMdzWcsQz9HmnEJ76U9dEgKAKBzzyYLUqE9cG0 +U2bBq/STRBdqmjTIPJiZ94bqtZ8BS3BExaFaqTWKl12ofAhsui6Faz7ACMc1AbSJv0e +glO9tUMVnCs2XPLLII153QImsf6crlR81I8F4x6NiFe5RISWL289kxo+A/umUZ5k8ZT qPDvmGrF8D6OlbfX+chjL0hrWVcWSFQepLQx1t3Psfbp+dGQRB9UyyA2dOw9QIJ1HTrh 1KP+pGfmBlkzvzj8uj2215KAxn6WUR9J/1QbHRdOKOsj+rb7oCswKjX4DerRbQu/0mhn Uuxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si843757ejb.508.2020.05.08.05.37.47; Fri, 08 May 2020 05:38:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727109AbgEHMgU (ORCPT + 99 others); Fri, 8 May 2020 08:36:20 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:35350 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726638AbgEHMgU (ORCPT ); Fri, 8 May 2020 08:36:20 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 529352369CD510014E30; Fri, 8 May 2020 20:36:17 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.487.0; Fri, 8 May 2020 20:36:07 +0800 From: Chen Zhou To: , , , , , CC: , , , Subject: [PATCH -next] sunrpc: use kmemdup_nul() in gssp_stringify() Date: Fri, 8 May 2020 20:40:00 +0800 Message-ID: <20200508124000.170708-1-chenzhou10@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is more efficient to use kmemdup_nul() if the size is known exactly . According to doc: "Note: Use kmemdup_nul() instead if the size is known exactly." Signed-off-by: Chen Zhou --- net/sunrpc/auth_gss/gss_rpc_upcall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c index 0349f455a862..af9c7f43859c 100644 --- a/net/sunrpc/auth_gss/gss_rpc_upcall.c +++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c @@ -223,7 +223,7 @@ static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg) static char *gssp_stringify(struct xdr_netobj *netobj) { - return kstrndup(netobj->data, netobj->len, GFP_KERNEL); + return kmemdup_nul(netobj->data, netobj->len, GFP_KERNEL); } static void gssp_hostbased_service(char **principal) -- 2.20.1