Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp730208rdb; Sun, 28 Jan 2024 06:36:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9RgBzR2EkW+lIaBC2KeNgdZD8yvB6dxDSt5juSiiDrFqhp+GjHcTx5PJqsI3yZBBgIFvb X-Received: by 2002:a17:906:2e95:b0:a35:8bbd:5ba9 with SMTP id o21-20020a1709062e9500b00a358bbd5ba9mr1079780eji.27.1706452585764; Sun, 28 Jan 2024 06:36:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706452585; cv=pass; d=google.com; s=arc-20160816; b=n6JrnwI9LebueFYY7G/zje6bIJKlFFZbRjATFZ8zNeGBGiYUU1SdlILyTNHMD2ovOy wr67l8kVOhc5OGa7U7XIEGZp1x5exDDcoLho+25CJKxkpd7ZMPsJ51biw1XKqsTqsvaN hFwiijiqYnYVOU30ZgzzoXszKqV4z/PT8dxcUKmqKienOCCR2JCfrcvc2mbfGJ/XAc/X gSBhK6Clx7aCrUjo5xwCAfoJZx3cQeL5CT3PW/B+DX0ESFPaAkscts3TSCzUobGz5H/s mjaJJYJqLJ8ZZUdQcj01UxUnRp1fqzkbDIQCIyFZZ9UyOdgUq3cU0U2lfJ70SfQdgEKx jDVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:subject:from:cc :content-language:to:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=kKg437D3FY+dpq/JnTTR1ryc/GJh0CdZV5bXSZQR72w=; fh=83JeIZ4ruoFYJmrqvK77+vvHq14BX7o8cv5PdMQljRI=; b=zMY74MLCT+i5wda1yNYolxh1wmVBLBMzwjRgD62o4qQdFJ7+AeIw0zuUdM4GUgJRNF YeFVQuqgsCJGUElc1oaV6gVp04VyCffx+ZAY1nFxf4Wz3FkxTf545DY3XIQNJXPNe04G Qy94HcAWUGPYmMrIEGYqeywLNbND3V2NchI7qkDVhiWMWXStJcYjCQ5cOFkPilvEyAgD BFEC5stMoezYQBZKmo4ZKOKWI835RSt342R0EvV9N8oela4WvWFiIK70X31WNEXdV7GV gO/9PS82Q0SJTBCiZFBRw9PViFkimUGWkfo3fZ6PgmiNck3uR0UR9m/7msqTPhH6Wx3H pG0g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=VO8NY6o1; arc=pass (i=1 spf=pass spfdomain=web.de dkim=pass dkdomain=web.de dmarc=pass fromdomain=web.de); spf=pass (google.com: domain of linux-kernel+bounces-41650-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41650-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ce8-20020a170906b24800b00a34b0e1a75bsi2659367ejb.432.2024.01.28.06.36.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 06:36:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41650-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=VO8NY6o1; arc=pass (i=1 spf=pass spfdomain=web.de dkim=pass dkdomain=web.de dmarc=pass fromdomain=web.de); spf=pass (google.com: domain of linux-kernel+bounces-41650-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41650-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 556831F209AB for ; Sun, 28 Jan 2024 14:36:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6ED72208A5; Sun, 28 Jan 2024 14:36:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="VO8NY6o1" Received: from mout.web.de (mout.web.de [212.227.17.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83B8A210EC; Sun, 28 Jan 2024 14:36:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706452566; cv=none; b=DFPBdQgZd3WmpsfiLu2iEJqFWlL1JA0fU2ZKYTDSjO1E3sUSfkIcgPpP1sAYaLhGxx4A/7gOTqjRh0F1tUa/0uDlBqGX5lfnEE2ijya9w/y9fAHhHE4LIT44x6pvh3Q6ug8biuNB+7R20dTQUqZ888FJVVehFgOev5ypnm901mY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706452566; c=relaxed/simple; bh=aDhTgz/lX7Bkp3K6CN8opRhhDbmP/3uNFck7LgFe5CU=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=SHoJGbxpB9jKHkQs0Pu7ViYM1jI8HMTvc8kqVBPTZQR4Q4DbTYZjzBBshUrVlG8HlK9UQsLOgfTr4Hi0zvAc7Bn6MZIlVrDeqfJRByNEIERHoGwC3mNHdsHdI3sLMEOMywp3VlPKjE2NkzW6FoD32OSlmAvB9mtzMeNWfJ7WfNo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de; spf=pass smtp.mailfrom=web.de; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b=VO8NY6o1; arc=none smtp.client-ip=212.227.17.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1706452523; x=1707057323; i=markus.elfring@web.de; bh=aDhTgz/lX7Bkp3K6CN8opRhhDbmP/3uNFck7LgFe5CU=; h=X-UI-Sender-Class:Date:To:Cc:From:Subject; b=VO8NY6o1qfC2CM0mraF4vuZSgvoWdJoqLKjcPonwW4G3xN9mhhLA7klmNPWkdcRu BuDCol+0gbX7dxft0pVjLcXbx90EUgQib0YZXNGT37h0/OTfxjzIVbVJ2BNBuJtpw VOtlqmLf+p+MwdxBDdvzlucyi5Gt9YtlRjc2eLPeT/Lor8Y3UEZBBPGjTlNdIo59k W2tuiZZ7Xl1o65QhoIgILPAW5opsS/nQtdjqoBc191VFHSIx+3YTJ7pgXWisiQn3i 81FZygEvhzTYbAktBEmnjWVcBhr7xXUy9WgjPOMde8QUoy8ouZ9jyDPDq9vLOHdCF M6N85Nt9gJt6kU7hkw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.81.95]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MdfCN-1qvJfO1p33-00ZKhY; Sun, 28 Jan 2024 15:35:23 +0100 Message-ID: Date: Sun, 28 Jan 2024 15:35:19 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: linux-arm-msm@vger.kernel.org, kernel-janitors@vger.kernel.org, Arnd Bergmann , Amol Maheshwari , Greg Kroah-Hartman , Srinivas Kandagatla Content-Language: en-GB Cc: LKML , Cong Liu , Kunwu Chan From: Markus Elfring Subject: [PATCH] misc: fastrpc: Use memdup_user() rather than duplicating its implementation Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:zZMLk8SHPdlT/iFiSdZ96fIUhgyIRJ8/yu4u6XWi3ISKCeTji/X vMt3iqkqVdSwkBiDBsO/x+Ck7VH2nS3ezzOngZ0DIh7yee2GtGAz9PVLntmHT0RozzKwGyl eECNFurF6wnnyJSkZFsKew5FHOjE+liIy9+ZzZ90Jub/+vC1qiDKdlIbOI0egQcifDuRtw1 MqiN+h5G2QU5coCXi2HHQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:nBeIRC6Gwa8=;SOz2uok6iiYTx+oo4qTbZNPc9z+ XA9ypAbomu0MU5kJNtcwx+69odXvSk3UOsT+aB1bHPx8AWPDIebHl9o6Ux+NxLaw08bP/T3uB uzEZlo9Ug47s4A4VR1ChhfGRht8kLvJuxhvZLjFtP61q9SSgOx0os3s3kAUqAhm7hgt6Zrc0w 6rVrU+6eSm+UdZQC2zZTtWfJOkHbBubCrs/NkTQwk4E+08Wy6C6f/q9Kj0jnvBPN7t3VqEbFu shT9Mkr4gyzRAGA6q1atE+gzzdPDPZKWDdgFcrmBxf5dXI7c1nFo2htop5hhPuiG6Thpn2cpl k9P2oEYQ+Mj8aBv4feQl7ONYNjCEdor0mqP2jUtKYhvN6kVWAqTD4d3KgDCEuatmSKsPlxPdt +uweEjw9Vq45Cdf8sdiSlqfXZaRqnn4FUEcJ9rec6ZmXzN+k6Qoag6IDqm9jUl7Gnq6XcSwtq 4pa8Co6rvj4MNnrbSHZ5S/cNl13cleTWO3jH0cQpK+njtx76NOAZB+esdfEVPPOWnwBRuDYg5 IoORNqAa2meEx8tea1hAVDcZiOsyvqTr6ZIa+01LPimEHjjPbjpoEVyeBKFiDA5MuaTO7yPWp pJTFQbQ2fcbzUAfeJ9+27h7fs+8QBUBMN62mUUGesmZ1Nbc1yFMU76haTBas4F5WFisWyjQxn x83c2w+y8N0n7NgdzA3i0ZMVu9wybfPoWho9G6HVqGmVXJ6XUyZnpJKWFmaJCVD4KumLQvi9H U1r91xuGWx5RTDFAXYF5yRWB3ucL1v8StYFavKAxiIZjEOn9DauUovoa2uKcQ1571gcR/R7Vl 7Yp9IUgn1RUrJa95S3uz5xq+Evuat37N6AfAxv9nHJIpN6wG9d2AEzuz3EhUJ/kXnx6MnMQES VUbH3hlcJm4vjRpHcOZXRLqY7Wpj1dGPG/c0VREF0VSTS9EYNmXYkEXBhFtlq2TiWGOkXiOtR KcSBZNTSSbXksyR71YBE/Zn8M8M= From: Markus Elfring Date: Sun, 28 Jan 2024 15:17:03 +0100 Reuse existing functionality from memdup_user() instead of keeping duplicate source code. Generated by: scripts/coccinelle/api/memdup_user.cocci Signed-off-by: Markus Elfring =2D-- drivers/misc/fastrpc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 1c6c62a7f7f5..83da6ad4e541 100644 =2D-- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1260,17 +1260,12 @@ static int fastrpc_init_create_static_process(stru= ct fastrpc_user *fl, goto err; } - name =3D kzalloc(init.namelen, GFP_KERNEL); - if (!name) { - err =3D -ENOMEM; + name =3D memdup_user(init.name, init.namelen); + if (IS_ERR(name) { + err =3D PTR_ERR(name); goto err; } - if (copy_from_user(name, (void __user *)(uintptr_t)init.name, init.namel= en)) { - err =3D -EFAULT; - goto err_name; - } - if (!fl->cctx->remote_heap) { err =3D fastrpc_remote_heap_alloc(fl, fl->sctx->dev, init.memlen, &fl->cctx->remote_heap); =2D- 2.43.0