Message ID | 1415025649-8119-6-git-send-email-javier.martinez@collabora.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Nov 03, 2014 at 03:40:40PM +0100, Javier Martinez Canillas wrote: > The struct of_regulator_match rmatch[] is declared as a non-static local > variable so the structure members are not auto-initialized. Applied, thanks. This is a bug fix not *that* closely related to the rest of the series, if it's being included in a series like this it should've been at the start of the series not after substantial new feature additions so that the fixes don't get ignored due to problems with the features and so that the fixes can be sent to Linus without dependencies.
On 11/03/2014 04:41 PM, Mark Brown wrote: > On Mon, Nov 03, 2014 at 03:40:40PM +0100, Javier Martinez Canillas wrote: >> The struct of_regulator_match rmatch[] is declared as a non-static local >> variable so the structure members are not auto-initialized. > > Applied, thanks. > > This is a bug fix not *that* closely related to the rest of the series, > if it's being included in a series like this it should've been at the > start of the series not after substantial new feature additions so that > the fixes don't get ignored due to problems with the features and so > that the fixes can be sent to Linus without dependencies. > True, I added in the series since of_get_regulation_constraints() checks if the struct regulator_desc * pointer is not NULL and so drivers that don't initialize the struct of_regulator_match containing that pointer will make that check to fail and the pointer be wrongly dereferenced. Sorry, next time I'll post fixes separately and make the series depend on that instead. Best regards, Javier -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c index 86db310..d2a8c64 100644 --- a/drivers/regulator/max1586.c +++ b/drivers/regulator/max1586.c @@ -163,7 +163,7 @@ static int of_get_max1586_platform_data(struct device *dev, struct max1586_platform_data *pdata) { struct max1586_subdev_data *sub; - struct of_regulator_match rmatch[ARRAY_SIZE(max1586_reg)]; + struct of_regulator_match rmatch[ARRAY_SIZE(max1586_reg)] = { }; struct device_node *np = dev->of_node; int i, matched;
The struct of_regulator_match rmatch[] is declared as a non-static local variable so the structure members are not auto-initialized. Initialize the array at declaration time to avoid the structure members values to be indeterminate and have sane defaults instead. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> --- drivers/regulator/max1586.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)