summaryrefslogtreecommitdiff
path: root/drivers/of/module.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2024-04-09 23:27:14 +0100
committerMark Brown <broonie@kernel.org>2024-04-09 23:27:14 +0100
commit8a8317f92770ab70ff39b15de74bdb3a07fdb6cb (patch)
treece65ca0b98c15e7358925ecba5273eefb1b50256 /drivers/of/module.c
parentaad6b35290f52639d3601063d33d9621c0948a04 (diff)
parentf63eb9ae085dc6da27eebfe35317e07a6a02a160 (diff)
regmap: kunit: Add some test cases and a few small
Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>: This series adds some more test cases, mainly for testing: commit eaa03486d932 ("regmap: maple: Fix uninitialized symbol 'ret' warnings") commit 00bb549d7d63 ("regmap: maple: Fix cache corruption in regcache_maple_drop()") And the pending patch ("regmap: Add regmap_read_bypassed()") There are also a few small improvements to the KUnit implementation.
Diffstat (limited to 'drivers/of/module.c')
-rw-r--r--drivers/of/module.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/of/module.c b/drivers/of/module.c
index 0e8aa974f0f2..f58e624953a2 100644
--- a/drivers/of/module.c
+++ b/drivers/of/module.c
@@ -16,6 +16,14 @@ ssize_t of_modalias(const struct device_node *np, char *str, ssize_t len)
ssize_t csize;
ssize_t tsize;
+ /*
+ * Prevent a kernel oops in vsnprintf() -- it only allows passing a
+ * NULL ptr when the length is also 0. Also filter out the negative
+ * lengths...
+ */
+ if ((len > 0 && !str) || len < 0)
+ return -EINVAL;
+
/* Name & Type */
/* %p eats all alphanum characters, so %c must be used here */
csize = snprintf(str, len, "of:N%pOFn%c%s", np, 'T',