Re: [PATCH v2 4/6] MFD MAX8998/LP3974 Bufgix: accessing array outof bound.

From: Mark Brown
Date: Wed Dec 22 2010 - 08:29:29 EST


On Wed, Dec 22, 2010 at 03:23:09PM +0900, MyungJoo Ham wrote:

> The previous driver may access ldo_voltage_map[] out of its bound at
> probe function at line 790 (drivers/regulator/max8998.c). This patch
> allocates an entry for every regulator in order to avoid accessing
> out-of-bounds.
>
> Signed-off-by: MyungJoo Ham <myungjoo.ham@xxxxxxxxxxx>
> Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>

Acked-by: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>

for the fix but

> &buck4_voltage_map_desc, /* BUCK4 */
> + NULL, /* EN32KHZ_AP */
> + NULL, /* EN32KHZ_CP */
> + NULL, /* ENVICHG */
> + NULL, /* ESAFEOUT1 */
> + NULL, /* ESAFEOUT2 */

it might be nicer to do this with a constant for the array size, or by
having the users check for ARRAY_SIZE().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/