* [PATCH] mfd: syscon: Fix null pointer dereference in of_syscon_register
@ 2023-12-04 9:24 Kunwu Chan
2023-12-04 10:06 ` Arnd Bergmann
2023-12-07 16:05 ` (subset) " Lee Jones
0 siblings, 2 replies; 3+ messages in thread
From: Kunwu Chan @ 2023-12-04 9:24 UTC (permalink / raw)
To: lee, arnd, s-anna; +Cc: kunwu.chan, linux-kernel, Kunwu Chan
kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure.
Fixes: e15d7f2b81d2 ("mfd: syscon: Use a unique name with regmap_config")
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
drivers/mfd/syscon.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 57b29c325131..c9550368d9ea 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -105,6 +105,10 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)
}
syscon_config.name = kasprintf(GFP_KERNEL, "%pOFn@%pa", np, &res.start);
+ if (!syscon_config.name) {
+ ret = -ENOMEM;
+ goto err_regmap;
+ }
syscon_config.reg_stride = reg_io_width;
syscon_config.val_bits = reg_io_width * 8;
syscon_config.max_register = resource_size(&res) - reg_io_width;
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: syscon: Fix null pointer dereference in of_syscon_register
2023-12-04 9:24 [PATCH] mfd: syscon: Fix null pointer dereference in of_syscon_register Kunwu Chan
@ 2023-12-04 10:06 ` Arnd Bergmann
2023-12-07 16:05 ` (subset) " Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2023-12-04 10:06 UTC (permalink / raw)
To: Kunwu Chan, Lee Jones, s-anna; +Cc: kunwu.chan, linux-kernel
On Mon, Dec 4, 2023, at 10:24, Kunwu Chan wrote:
> kasprintf() returns a pointer to dynamically allocated memory
> which can be NULL upon failure.
>
> Fixes: e15d7f2b81d2 ("mfd: syscon: Use a unique name with regmap_config")
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: (subset) [PATCH] mfd: syscon: Fix null pointer dereference in of_syscon_register
2023-12-04 9:24 [PATCH] mfd: syscon: Fix null pointer dereference in of_syscon_register Kunwu Chan
2023-12-04 10:06 ` Arnd Bergmann
@ 2023-12-07 16:05 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2023-12-07 16:05 UTC (permalink / raw)
To: lee, arnd, s-anna, Kunwu Chan; +Cc: kunwu.chan, linux-kernel
On Mon, 04 Dec 2023 17:24:43 +0800, Kunwu Chan wrote:
> kasprintf() returns a pointer to dynamically allocated memory
> which can be NULL upon failure.
>
>
Applied, thanks!
[1/1] mfd: syscon: Fix null pointer dereference in of_syscon_register
commit: 41673c66b3d0c09915698fec5c13b24336f18dd1
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-07 16:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-04 9:24 [PATCH] mfd: syscon: Fix null pointer dereference in of_syscon_register Kunwu Chan
2023-12-04 10:06 ` Arnd Bergmann
2023-12-07 16:05 ` (subset) " Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®