diff options
author | John Keeping <john@metanate.com> | 2022-09-07 12:11:42 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-10-11 15:40:48 -0400 |
commit | 7eda1a95331d1ccd17e5af6fb18bf5577f81a451 (patch) | |
tree | 722505106dcdfcb42b6811958719e798a18ea3a4 | |
parent | 45455e8ff5634e77aede803f9a772dba08b9674f (diff) | |
download | u-boot-7eda1a95331d1ccd17e5af6fb18bf5577f81a451.zip u-boot-7eda1a95331d1ccd17e5af6fb18bf5577f81a451.tar.gz u-boot-7eda1a95331d1ccd17e5af6fb18bf5577f81a451.tar.bz2 |
pinctrl: fix buffer size for pinctrl_generic_set_state_prefix()
This buffer has the concatenated prefix and name written into it, so it
must be large enough to cover both strings plus the terminating NUL.
Fixes: 92c4a95ec7 ("pinctrl: Add new function pinctrl_generic_set_state_prefix()")
Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | drivers/pinctrl/pinctrl-generic.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-generic.c b/drivers/pinctrl/pinctrl-generic.c index ec21d4f..8909b57 100644 --- a/drivers/pinctrl/pinctrl-generic.c +++ b/drivers/pinctrl/pinctrl-generic.c @@ -237,7 +237,7 @@ enum pinmux_subnode_type { static const char *alloc_name_with_prefix(const char *name, const char *prefix) { if (prefix) { - char *name_with_prefix = malloc(strlen(prefix) + sizeof("pins")); + char *name_with_prefix = malloc(strlen(prefix) + strlen(name) + 1); if (name_with_prefix) sprintf(name_with_prefix, "%s%s", prefix, name); return name_with_prefix; |