lkml.org 
[lkml]   [2012]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[ 18/54] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions()
    Date
    3.6-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Sachin Kamat <sachin.kamat@linaro.org>

    commit 5a6ea4af0907f995dc06df21a9c9ef764c7cd3bc upstream.

    The pointer returned by kzalloc should be tested for NULL
    to avoid potential NULL pointer dereference later. Incorrect
    pointer was being tested for NULL. Bug introduced by commit fbcf62a3
    (mtd: physmap_of: move parse_obsolete_partitions to become separate
    parser).
    This patch fixes this bug.

    Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
    Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
    Cc: Artem Bityutskiy <artem.bityutskiy@intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/mtd/ofpart.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/drivers/mtd/ofpart.c
    +++ b/drivers/mtd/ofpart.c
    @@ -121,7 +121,7 @@ static int parse_ofoldpart_partitions(st
    nr_parts = plen / sizeof(part[0]);

    *pparts = kzalloc(nr_parts * sizeof(*(*pparts)), GFP_KERNEL);
    - if (!pparts)
    + if (!*pparts)
    return -ENOMEM;

    names = of_get_property(dp, "partition-names", &plen);



    \
     
     \ /
      Last update: 2012-12-01 02:21    [W:2.714 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site