diff options
| author | Ingo Molnar <mingo@kernel.org> | 2024-04-09 09:28:41 +0200 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2024-04-09 09:28:41 +0200 |
| commit | 0e6ebfd163645d300fdf4abedd1718195ad293bc (patch) | |
| tree | 510614aa8a43af846e27c7581adda801eaf03fc6 /drivers/of/module.c | |
| parent | 186d7ef52c1f0c41450dedbdf6d6325d0a84e4c5 (diff) | |
| parent | fec50db7033ea478773b159e0e2efb135270e3b7 (diff) | |
Merge tag 'v6.9-rc3' into x86/cpu, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/of/module.c')
| -rw-r--r-- | drivers/of/module.c | 8 |
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', |
