lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <OSBPR01MB1670FF3930C3B1736E7EFC23BC24A@OSBPR01MB1670.jpnprd01.prod.outlook.com>
Date: Wed, 30 Jul 2025 21:17:46 +0800
From: Shiji Yang <yangshiji66@...look.com>
To: devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: Rafał Miłecki <rafal@...ecki.pl>,
	Srinivas Kandagatla <srini@...nel.org>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Shiji Yang <yangshiji66@...look.com>
Subject: [PATCH 1/2] nvmem: u-boot-env: support specifying the env storage size

In the current code, we always assume that the env storage size is
the same as the mtd partition size. U-boot supports customizing the
size of the environment area. If its size is different from the MTD
partition size. This will result in CRC32 verification error. This
patch will introduce a new property env-size to give users a chance
to configure the correct env storage size.

Signed-off-by: Shiji Yang <yangshiji66@...look.com>
---
 drivers/nvmem/u-boot-env.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/nvmem/u-boot-env.c b/drivers/nvmem/u-boot-env.c
index ced414fc9..ac9858010 100644
--- a/drivers/nvmem/u-boot-env.c
+++ b/drivers/nvmem/u-boot-env.c
@@ -52,6 +52,7 @@ static int u_boot_env_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct u_boot_env *priv;
+	u32 env_size;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -68,7 +69,12 @@ static int u_boot_env_probe(struct platform_device *pdev)
 
 	config.dev = dev;
 	config.priv = priv;
-	config.size = priv->mtd->size;
+
+	if (!of_property_read_u32(np, "env-size", &env_size) &&
+	    env_size <= priv->mtd->size)
+		config.size = env_size;
+	else
+		config.size = priv->mtd->size;
 
 	priv->nvmem = devm_nvmem_register(dev, &config);
 	if (IS_ERR(priv->nvmem))
-- 
2.50.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ