lkml.org 
[lkml]   [2022]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/3] thermal: int340x: Fix bogus acpi_buffer pointer freeing
From
Date
On Thu, 2022-03-24 at 12:09 -0700, Davidlohr Bueso wrote:
> It is the caller's responsibility to free only upon ACPI_SUCCESS.
>

Since context->ret.pointer will be NULL on failure so calling kfree
will just return.

Although we can avoid this call to kfree.

Thanks,
Srinivas

> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> ---
>  drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> index 4954800b9850..0e7931c286ec 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> @@ -186,11 +186,11 @@ static int int3400_thermal_run_osc(acpi_handle
> handle, char *uuid_str, int *enab
>                 ret = *((u32 *)(context.ret.pointer + 4));
>                 if (ret != *enable)
>                         result = -EPERM;
> +
> +               kfree(context.ret.pointer);
>         } else
>                 result = -EPERM;
>  
> -       kfree(context.ret.pointer);
> -
>         return result;
>  }
>  


\
 
 \ /
  Last update: 2022-03-25 13:28    [W:0.080 / U:0.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site