Skip to content

Commit 8303d1a

Browse files
committed
Merge tag 'regulator-fix-v6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fix from Mark Brown: "This fixes an invalid memory access in the MAX20086 driver which could occur during error handling for failed probe due to a hidden use of devres in the core DT parsing code" * tag 'regulator-fix-v6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: max20086: fix invalid memory access
2 parents 7dc774f + 6b0cd72 commit 8303d1a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/regulator/max20086-regulator.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static int max20086_regulators_register(struct max20086 *chip)
132132

133133
static int max20086_parse_regulators_dt(struct max20086 *chip, bool *boot_on)
134134
{
135-
struct of_regulator_match matches[MAX20086_MAX_REGULATORS] = { };
135+
struct of_regulator_match *matches;
136136
struct device_node *node;
137137
unsigned int i;
138138
int ret;
@@ -143,6 +143,11 @@ static int max20086_parse_regulators_dt(struct max20086 *chip, bool *boot_on)
143143
return -ENODEV;
144144
}
145145

146+
matches = devm_kcalloc(chip->dev, chip->info->num_outputs,
147+
sizeof(*matches), GFP_KERNEL);
148+
if (!matches)
149+
return -ENOMEM;
150+
146151
for (i = 0; i < chip->info->num_outputs; ++i)
147152
matches[i].name = max20086_output_names[i];
148153

0 commit comments

Comments
 (0)