Commit 0645c83d authored by Vincent Stehlé's avatar Vincent Stehlé Committed by Stefan Bader

regulator: isl9305: fix array size

BugLink: http://bugs.launchpad.net/bugs/1764666

[ Upstream commit 0c08aaf8 ]

ISL9305_MAX_REGULATOR is the last index used to access the init_data[]
array, so we need to add one to this last index to obtain the necessary
array size.

This fixes the following smatch error:

  drivers/regulator/isl9305.c:160 isl9305_i2c_probe() error: buffer overflow 'pdata->init_data' 3 <= 3

Fixes: dec38b5c ("regulator: isl9305: Add Intersil ISL9305/H driver")
Signed-off-by: default avatarVincent Stehlé <vincent.stehle@laposte.net>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent ed0d5f5a
......@@ -24,7 +24,7 @@
struct regulator_init_data;
struct isl9305_pdata {
struct regulator_init_data *init_data[ISL9305_MAX_REGULATOR];
struct regulator_init_data *init_data[ISL9305_MAX_REGULATOR + 1];
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment