lkml.org 
[lkml]   [2009]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] regulator: add check index of wm8350->pmic.pdev[]
    Ensure that reg is within the bounds of array wm8350->pmic.pdev[].

    Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
    ---
    diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
    index 771eca1..c806259 100644
    --- a/drivers/regulator/wm8350-regulator.c
    +++ b/drivers/regulator/wm8350-regulator.c
    @@ -1419,6 +1419,8 @@ int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
    {
    struct platform_device *pdev;
    int ret;
    + if (reg < 0 || reg >= NUM_WM8350_REGULATORS)
    + return -EINVAL;

    if (wm8350->pmic.pdev[reg])
    return -EBUSY;

    \
     
     \ /
      Last update: 2009-06-15 20:33    [W:0.023 / U:34.480 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site