Message ID | e274344b44d5f80fa54c52f530387257fe99ec65.1731505681.git.ritesh.list@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D47FD462AA for <linux-mm@archiver.kernel.org>; Wed, 13 Nov 2024 14:20:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C23736B00B7; Wed, 13 Nov 2024 09:20:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BD2CF6B00DC; Wed, 13 Nov 2024 09:20:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A74786B00DE; Wed, 13 Nov 2024 09:20:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7F3036B00B7 for <linux-mm@kvack.org>; Wed, 13 Nov 2024 09:20:11 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3BA411A0217 for <linux-mm@kvack.org>; Wed, 13 Nov 2024 14:20:11 +0000 (UTC) X-FDA: 82781278440.20.BD8F955 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf22.hostedemail.com (Postfix) with ESMTP id D9D9CC002A for <linux-mm@kvack.org>; Wed, 13 Nov 2024 14:19:15 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="NAjUbAl/"; spf=pass (imf22.hostedemail.com: domain of ritesh.list@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=ritesh.list@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731507465; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=E+W5/1/yBRnzApluXvmZS6wnEL9+HSsK6+2J6aji4ic=; b=TeloJNz4m2G6ppKIAC8SqCpm+usTmwcpgVvhuT4qfbXj11TofPECH11PqNKdBSdMXrmEjv ByhZ9SKFnfHiyZe+8ThrlzDAtUC/zOT85rkIL4gD/38qlCpTqNoVNLeIhUEL5jFtJR0iVF /vGDBzDF4NkrF++Z3BrualwEmFkQ/tg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731507466; a=rsa-sha256; cv=none; b=1ZvK9/RliMI8VY4Md6SgOylEX8nd8xJaLDjZKk0Ert/2eyNxX9+9gSWKmgEeS+a7LFkDk2 RxTFMzH2169PVv47bycPgTvg0838E4IrIotEpgcKO/NgODa4IvMS8vYdxlLRHna4PQm+rr 2ZSiIj5acNdoiPa31xLR1JngRfEfW+A= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="NAjUbAl/"; spf=pass (imf22.hostedemail.com: domain of ritesh.list@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=ritesh.list@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-20c714cd9c8so71801255ad.0 for <linux-mm@kvack.org>; Wed, 13 Nov 2024 06:20:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731507608; x=1732112408; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=E+W5/1/yBRnzApluXvmZS6wnEL9+HSsK6+2J6aji4ic=; b=NAjUbAl/+1ypXTUjlM4M7wJ0ynsEO887Lo3I/+HNP4uEnXmgajd54xUPpW/m82v20A +WLnICz1yaeGhAf2TaSI1fkjaG5n0Po1vXx/xrdzVbLf/ImicOa5eyklQL7gJW51uG66 WZ3caXfneTUqMmwcnkspyQcT1aFOnz0qj07qoQ8f3wy+FNGTlKhzB2a/O4ym4t5htMg3 ajlQMXY/ESbvi9/wy0bAwKvnw5CmIrEpIsHuAYlXU2JdUzvN8anxgrSMaDAUf8k1BC+M Sg7cdq9Q8opGvc3UP2IwldnBidimolpj823MDuh59L9ZaSp8Gj7InTCYFmiJm+x5Q71U y6lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731507608; x=1732112408; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=E+W5/1/yBRnzApluXvmZS6wnEL9+HSsK6+2J6aji4ic=; b=YYR8DozukohT+17ziUnrr0uhtU498Fp7RMja0OCGJ13+SRLQWbhLLS2TBfZD9ld7gC 3JtILS4sJlQ3H8li2xMOo47qtmu17CIlQwj6kuYz5exzl8ZrV7/B5P+FO8HDnW2A1WyE H/nIsd2Ck0Fbl2jkIzjpvLAwL3Hr5y2moEI61dho/QKNxAnfHmOCg1ccNFMbMIWYEZcF 3AkP5qE3jv9Q5GgSS6pa7motZKt4aQwBElWUUlpLK8Af28MPC+JQDZ+A9zNXo3QdWyqC K6iIelWpNYNUb3NRFyNMX4smBJDJ0t5Pla6U3sdJz0q0oSTzMPFkIkNhrQK3TxVB0pbZ GoJQ== X-Gm-Message-State: AOJu0Yx/arkFf7ffcuWKc9lJLs/PyJ6UD6R8+zrEC8S8YbwZO1E98NFS cB5AOVFikSIf1tAwBuDG9mkWYF2xCV1hzJBDDjjoJaeNXB7jWyYK X-Google-Smtp-Source: AGHT+IGeOAmmIL3JeGd2B/FeYzTlCYu440XfiAvTwoYmEtolyVkG9FqkwR5NzpR2JeHhiVjtarSHuQ== X-Received: by 2002:a17:902:ea02:b0:20c:5c13:732e with SMTP id d9443c01a7336-21183e11d8bmr278709445ad.38.1731507607853; Wed, 13 Nov 2024 06:20:07 -0800 (PST) Received: from dw-tp.ibmuc.com ([171.76.87.84]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21177e6ab8fsm110636045ad.226.2024.11.13.06.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 06:20:07 -0800 (PST) From: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, Sourabh Jain <sourabhjain@linux.ibm.com>, Hari Bathini <hbathini@linux.ibm.com>, Zi Yan <ziy@nvidia.com>, David Hildenbrand <david@redhat.com>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>, Mahesh J Salgaonkar <mahesh@linux.ibm.com>, Michael Ellerman <mpe@ellerman.id.au>, Madhavan Srinivasan <maddy@linux.ibm.com>, "Aneesh Kumar K . V" <aneesh.kumar@kernel.org>, Donet Tom <donettom@linux.vnet.ibm.com>, LKML <linux-kernel@vger.kernel.org>, Sachin P Bappalige <sachinpb@linux.ibm.com>, "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>, Anshuman Khandual <anshuman.khandual@arm.com> Subject: [PATCH v4 -next] cma: Enforce non-zero pageblock_order during cma_init_reserved_mem() Date: Wed, 13 Nov 2024 19:49:54 +0530 Message-ID: <e274344b44d5f80fa54c52f530387257fe99ec65.1731505681.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D9D9CC002A X-Stat-Signature: c391ro5nikitf8icun66hyeth1k4jr4m X-HE-Tag: 1731507555-205225 X-HE-Meta: U2FsdGVkX1/xvJj6Z2Sw16DbtBQSbG99E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bOkxkLslwdycN6Cm1em64rqnAMe1lbl0acuR+G4TAxSV3NPsiXiieDRltZ/FnyNN+z8zsJ6SVFRXRqJVHyC7+113ExHxIUV5KaNjFjWnfdxLCoV9Cw5rQY2GALhQ9ktF/waoFi/rOLZ2yxpkp5pTxBuMXt0KNbjF7YYzb5tGUC51ukHexRC3SqybrtyQmWuQOAebprbCsEQmTwM6yY14ni/mgspQ55v7v5jDCKad5FFNnahw8fZwnCJ+4ye8zYhL18APOr8g/0krQzenrKJXXEZF8mwPjsWzoDBhMjC4OetZ8vq2KdW2eoTkMHeSek5mma15goM+IDSMRKxmQLBZ0xkhvk9knIQo4ECJn7WAedBXMz4Fjj6NX+ydxcA4oQC2zYmjdOJgKZfIodR2zs8+06Oq65KaKCfDtocpzFCkLw8LYlcklobTibF210ucD+kN2X9RN1GVOJd6ZL0iwA65xQ3DslpzJOLMlvNx1sXrBqSv8c3CZvHv/l7DMKdL329bHHgJ1HN630iDtJlWhkrLnLtGgRubPtMkx9rC7cCAcJCF0Kq7Io= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
[v4,-next] cma: Enforce non-zero pageblock_order during cma_init_reserved_mem()
|
expand
|
diff --git a/mm/cma.c b/mm/cma.c index 3e9724716bad..36d753e7a0bf 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -182,6 +182,15 @@ int __init cma_init_reserved_mem(phys_addr_t base, phys_addr_t size, if (!size || !memblock_is_region_reserved(base, size)) return -EINVAL; + /* + * CMA uses CMA_MIN_ALIGNMENT_BYTES as alignment requirement which + * needs pageblock_order to be initialized. Let's enforce it. + */ + if (!pageblock_order) { + pr_err("pageblock_order not yet initialized. Called during early boot?\n"); + return -EINVAL; + } + /* ensure minimal alignment required by mm core */ if (!IS_ALIGNED(base | size, CMA_MIN_ALIGNMENT_BYTES)) return -EINVAL;