* [PATCH] regulator: max8649: Fix NULL pointer dereference in probe
@ 2026-08-25 9:01 Yang Zi
2026-08-26 13:34 ` Mark Brown
2026-08-26 18:36 ` Markus Elfring
0 siblings, 2 replies; 5+ messages in thread
From: Yang Zi @ 2026-08-25 9:01 UTC (permalink / raw)
To: lgirdwood, broonie; +Cc: linux-kernel
max8649_regulator_probe() dereferences pdata->mode without first checking
that platform data is available. When the device is instantiated without
platform data, pdata is NULL and probe crashes with a NULL pointer
dereference.
Add a check and return -EINVAL when pdata is NULL.
Signed-off-by: Yang Zi <2959243019@qq.com>
---
drivers/regulator/max8649.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index 2d17405242e7..7133b0aee889 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -170,6 +170,9 @@ static int max8649_regulator_probe(struct i2c_client *client)
info->dev = &client->dev;
i2c_set_clientdata(client, info);
+ if (!pdata)
+ return -EINVAL;
+
info->mode = pdata->mode;
switch (info->mode) {
case 0:
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] regulator: max8649: Fix NULL pointer dereference in probe
2026-08-25 9:01 [PATCH] regulator: max8649: Fix NULL pointer dereference in probe Yang Zi
@ 2026-08-26 13:34 ` Mark Brown
2026-08-26 18:36 ` Markus Elfring
1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2026-08-26 13:34 UTC (permalink / raw)
To: Yang Zi; +Cc: lgirdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 358 bytes --]
On Tue, Aug 25, 2026 at 05:01:15PM +0800, Yang Zi wrote:
> max8649_regulator_probe() dereferences pdata->mode without first checking
> that platform data is available. When the device is instantiated without
> platform data, pdata is NULL and probe crashes with a NULL pointer
> dereference.
This doesn't apply against curent code, please check and resend.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] regulator: max8649: Fix NULL pointer dereference in probe
2026-08-25 9:01 [PATCH] regulator: max8649: Fix NULL pointer dereference in probe Yang Zi
2026-08-26 13:34 ` Mark Brown
@ 2026-08-26 18:36 ` Markus Elfring
2026-08-26 18:39 ` Mark Brown
1 sibling, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2026-08-26 18:36 UTC (permalink / raw)
To: Yang Zi, kernel-janitors, Liam Girdwood, Mark Brown; +Cc: LKML
…
> Add a check and return -EINVAL when pdata is NULL.
How do you think about to perform this data processing
directly after the variable assignment?
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] regulator: max8649: Fix NULL pointer dereference in probe
2026-08-26 18:36 ` Markus Elfring
@ 2026-08-26 18:39 ` Mark Brown
2026-08-26 18:58 ` Robert P. J. Day
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2026-08-26 18:39 UTC (permalink / raw)
To: Markus Elfring; +Cc: Yang Zi, kernel-janitors, Liam Girdwood, LKML
[-- Attachment #1: Type: text/plain, Size: 374 bytes --]
On Wed, Aug 26, 2026 at 08:36:29PM +0200, Markus Elfring wrote:
> …
> > Add a check and return -EINVAL when pdata is NULL.
> How do you think about to perform this data processing
> directly after the variable assignment?
Feel free to ignore Markus, he has a long history of sending
unhelpful review comments and continues to ignore repeated requests
to stop.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] regulator: max8649: Fix NULL pointer dereference in probe
2026-08-26 18:39 ` Mark Brown
@ 2026-08-26 18:58 ` Robert P. J. Day
0 siblings, 0 replies; 5+ messages in thread
From: Robert P. J. Day @ 2026-08-26 18:58 UTC (permalink / raw)
To: Mark Brown; +Cc: Markus Elfring, Yang Zi, kernel-janitors, Liam Girdwood, LKML
[-- Attachment #1: Type: text/plain, Size: 531 bytes --]
On Wed, 26 Aug 2026, Mark Brown wrote:
> On Wed, Aug 26, 2026 at 08:36:29PM +0200, Markus Elfring wrote:
> > …
> > > Add a check and return -EINVAL when pdata is NULL.
>
> > How do you think about to perform this data processing
> > directly after the variable assignment?
>
> Feel free to ignore Markus, he has a long history of sending
> unhelpful review comments and continues to ignore repeated requests
> to stop.
I've recently wondered how easy it would be to write a "Markus
Elfring Random Suggestion Generator".
rday
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-26 19:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-25 9:01 [PATCH] regulator: max8649: Fix NULL pointer dereference in probe Yang Zi
2026-08-26 13:34 ` Mark Brown
2026-08-26 18:36 ` Markus Elfring
2026-08-26 18:39 ` Mark Brown
2026-08-26 18:58 ` Robert P. J. Day
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®