lkml.org 
[lkml]   [2010]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] X86: intel_ips, check for kzalloc properly
    On Mon, 21 Jun 2010 17:02:11 +0200
    Jiri Slaby <jslaby@suse.cz> wrote:

    > Stanse found that there are two NULL checks missing in ips_monitor. So
    > check their value too and bail out appropriately if the allocation
    > failed.
    >
    > Signed-off-by: Jiri Slaby <jslaby@suse.cz>
    > Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
    > Cc: Matthew Garrett <mjg@redhat.com>
    > ---
    > drivers/platform/x86/intel_ips.c | 3 ++-
    > 1 files changed, 2 insertions(+), 1 deletions(-)
    >
    > diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
    > index cdaf40e..3c7ea9a 100644
    > --- a/drivers/platform/x86/intel_ips.c
    > +++ b/drivers/platform/x86/intel_ips.c
    > @@ -931,7 +931,8 @@ static int ips_monitor(void *data)
    > mch_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL);
    > cpu_samples = kzalloc(sizeof(u32) * IPS_SAMPLE_COUNT, GFP_KERNEL);
    > mchp_samples = kzalloc(sizeof(u32) * IPS_SAMPLE_COUNT, GFP_KERNEL);
    > - if (!mcp_samples || !ctv1_samples || !ctv2_samples || !mch_samples) {
    > + if (!mcp_samples || !ctv1_samples || !ctv2_samples || !mch_samples ||
    > + !cpu_samples || !mchp_samples) {
    > dev_err(&ips->dev->dev,
    > "failed to allocate sample array, ips disabled\n");
    > kfree(mcp_samples);

    Ah cool, am I also missing the appropriate kfree() calls for the last
    two? The context doesn't have it. Otherwise,

    Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>

    --
    Jesse Barnes, Intel Open Source Technology Center


    \
     
     \ /
      Last update: 2010-06-21 17:29    [W:0.021 / U:181.240 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site