[PATCH] fs: set linux.bootargs.rootopts only when existing

Sascha Hauer
2026-04-20T07:57:50Z

Not all filesystems specify rootopts. Only create
linux.bootargs.rootopts when it's non NULL. Otherwise dev_get_param() on
this returns the literal string "<NULL>" which then shows up in the
Linux bootargs.

Reported-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/fs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index a562fe0fc6..5ca98ec127 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1244,8 +1244,9 @@ void fsdev_set_linux_root_options(struct fs_device *fsdev, const char *root, con

dev_add_param_fixed(&fsdev->dev, "linux.bootargs.root",
"%s", fsdev->linux_root);
- dev_add_param_fixed(&fsdev->dev, "linux.bootargs.rootopts",
- "%s", fsdev->linux_rootopts);
+ if (rootopts)
+ dev_add_param_fixed(&fsdev->dev, "linux.bootargs.rootopts",
+ "%s", fsdev->linux_rootopts);
}

void fsdev_get_linux_root_options(struct fs_device *fsdev,
--
2.47.3