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 X-Spam-Level: X-Spam-Status: No, score=-15.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham 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 0202EC433E0 for ; Sun, 17 Jan 2021 13:25:57 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A1D382226A for ; Sun, 17 Jan 2021 13:25:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1D382226A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To:Date:To:From: Subject:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0kREa6Y3oshnXydboBcM3TbWfbyisLWN2l93R0UVF9w=; b=BTdZd36Nn6tynoeX5dTpGiUXj 5zomjDcnPeZj5keNM61Wk6GWWc6Nb3EUTZx9ib2d5Dn599efnylWV+ABl68e6yGaXwldvZZKSZ35p XAGFwcnXlOdHpDR60JdEtYXoNJjVrpDBUGJGGk092eyjYSA3pJHjWux///aZjIfyzhsnDExHN3fbh io5/DdPH621p2+qP036gHq65MbK/5dZrBFSL5ahpVwmVkP/0dZvzbhZ63Td+jIQO/prrXUgPaDFy0 Kflh0BF1GGwT6FrI6Is+HD3dJUwysENmqbMoZsMnQglWnKbEBCamqfW1rKep/zV//82BalbG85n6A tUxb9c+QA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l182r-0000NR-LD; Sun, 17 Jan 2021 13:24:41 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l182o-0000MZ-7C for linux-arm-kernel@lists.infradead.org; Sun, 17 Jan 2021 13:24:39 +0000 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 10HD4MVu086084; Sun, 17 Jan 2021 08:24:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=woqyHjUD+Wk6Ib5O7OUBZ1HHzA3VJ6QiDNMM6trQ8E0=; b=tgEQN74HAtITOc3FbpINU+z+YxVXlSnqUggB0OwiPIKC9wCM6Mwp8cjbeNRwU2YHin0i 4yOXlNUvogquWbyZn2U6sxLPttaeVp6rIZPvwRlTEZdPX5hSm+e3IEruuLJOZf8a4mwC XJeuMZRVm0jBM5QDd7NjtdyO7TFbeZeiAC7a68GDMZ/qYljPz/GZoMAKtZnrH8B54erX 8Ri5qdkVUJs/Q8XSucKsT1eq6GEOClJSZJCFwk+edGKwc20Zo32ekfBKhIbQ9sQYF0Nu Zyq0xPV23CVtscYAvB9zJ1qtrv2Ao4dO4aMOX7TWRIjGeyIXbSjv34hF1+qeCP8nwgp9 UQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 364k16b0d9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 17 Jan 2021 08:24:07 -0500 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 10HDKrL2160007; Sun, 17 Jan 2021 08:24:06 -0500 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 364k16b0cu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 17 Jan 2021 08:24:06 -0500 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 10HDJ04G021917; Sun, 17 Jan 2021 13:24:04 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03fra.de.ibm.com with ESMTP id 363qs88kdn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 17 Jan 2021 13:24:04 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 10HDO1hV26804688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 17 Jan 2021 13:24:01 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C0B7B42041; Sun, 17 Jan 2021 13:24:01 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C64FF4203F; Sun, 17 Jan 2021 13:23:54 +0000 (GMT) Received: from li-f45666cc-3089-11b2-a85c-c57d1a57929f.ibm.com (unknown [9.160.41.68]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 17 Jan 2021 13:23:54 +0000 (GMT) Message-ID: <3c920af2da0d2650bc80bf8099bed7c6c549ca5b.camel@linux.ibm.com> Subject: Re: [PATCH v15 09/10] arm64: Call kmalloc() to allocate DTB buffer From: Mimi Zohar To: Lakshmi Ramasubramanian , bauerman@linux.ibm.com, robh@kernel.org, takahiro.akashi@linaro.org, gregkh@linuxfoundation.org, will@kernel.org, catalin.marinas@arm.com, mpe@ellerman.id.au, Arnd Bergmann Date: Sun, 17 Jan 2021 08:23:53 -0500 In-Reply-To: <20210115173017.30617-10-nramas@linux.microsoft.com> References: <20210115173017.30617-1-nramas@linux.microsoft.com> <20210115173017.30617-10-nramas@linux.microsoft.com> X-Mailer: Evolution 3.28.5 (3.28.5-14.el8) Mime-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-17_06:2021-01-15, 2021-01-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1011 mlxscore=0 adultscore=0 phishscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101170082 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210117_082438_583169_C700D03B X-CRM114-Status: GOOD ( 28.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, benh@kernel.crashing.org, bhsharma@redhat.com, tao.li@vivo.com, paulus@samba.org, vincenzo.frascino@arm.com, frowand.list@gmail.com, sashal@kernel.org, masahiroy@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, serge@hallyn.com, devicetree@vger.kernel.org, pasha.tatashin@soleen.com, prsriva@linux.microsoft.com, hsinyi@chromium.org, allison@lohutok.net, christophe.leroy@c-s.fr, mbrugger@suse.com, balajib@linux.microsoft.com, dmitry.kasatkin@gmail.com, linux-kernel@vger.kernel.org, james.morse@arm.com, linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org 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 Hi Ard, On Fri, 2021-01-15 at 09:30 -0800, Lakshmi Ramasubramanian wrote: > create_dtb() function allocates kernel virtual memory for > the device tree blob (DTB). This is not consistent with other > architectures, such as powerpc, which calls kmalloc() for allocating > memory for the DTB. > > Call kmalloc() to allocate memory for the DTB, and kfree() to free > the allocated memory. The vmalloc() function description says, "vmalloc - allocate virtually contiguous memory". I'd appreciate your reviewing this patch, in particular, which replaces vmalloc() with kmalloc(). thanks, Mimi > > Co-developed-by: Prakhar Srivastava > Signed-off-by: Prakhar Srivastava > Signed-off-by: Lakshmi Ramasubramanian > --- > arch/arm64/kernel/machine_kexec_file.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c > index 7de9c47dee7c..51c40143d6fa 100644 > --- a/arch/arm64/kernel/machine_kexec_file.c > +++ b/arch/arm64/kernel/machine_kexec_file.c > @@ -29,7 +29,7 @@ const struct kexec_file_ops * const kexec_file_loaders[] = { > > int arch_kimage_file_post_load_cleanup(struct kimage *image) > { > - vfree(image->arch.dtb); > + kfree(image->arch.dtb); > image->arch.dtb = NULL; > > vfree(image->arch.elf_headers); > @@ -59,19 +59,21 @@ static int create_dtb(struct kimage *image, > + cmdline_len + DTB_EXTRA_SPACE; > > for (;;) { > - buf = vmalloc(buf_size); > + buf = kmalloc(buf_size, GFP_KERNEL); > if (!buf) > return -ENOMEM; > > /* duplicate a device tree blob */ > ret = fdt_open_into(initial_boot_params, buf, buf_size); > - if (ret) > + if (ret) { > + kfree(buf); > return -EINVAL; > + } > > ret = of_kexec_setup_new_fdt(image, buf, initrd_load_addr, > initrd_len, cmdline); > if (ret) { > - vfree(buf); > + kfree(buf); > if (ret == -ENOMEM) { > /* unlikely, but just in case */ > buf_size += DTB_EXTRA_SPACE; > @@ -217,6 +219,6 @@ int load_other_segments(struct kimage *image, > return 0; > > out_err: > - vfree(dtb); > + kfree(dtb); > return ret; > } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel