lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87o9qw8d1u.fsf@intel.com>
Date:   Thu, 31 Aug 2017 09:30:05 +0300
From:   Jani Nikula <jani.nikula@...ux.intel.com>
To:     Himanshu Jha <himanshujha199640@...il.com>
Cc:     joonas.lahtinen@...ux.intel.com, rodrigo.vivi@...el.com,
        airlied@...ux.ie, intel-gfx@...ts.freedesktop.org,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        Himanshu Jha <himanshujha199640@...il.com>
Subject: Re: [PATCH] drm/i915/opregion: Remove null check before kfree

On Wed, 30 Aug 2017, Himanshu Jha <himanshujha199640@...il.com> wrote:
> kfree on NULL pointer is a no-op and therefore checking is redundant.

IMO the code has more clarity as it is.

BR,
Jani.

>
> Signed-off-by: Himanshu Jha <himanshujha199640@...il.com>
> ---
>  drivers/gpu/drm/i915/intel_opregion.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
> index 98154ef..2427b40 100644
> --- a/drivers/gpu/drm/i915/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/intel_opregion.c
> @@ -830,10 +830,8 @@ void intel_opregion_unregister(struct drm_i915_private *dev_priv)
>  		memunmap(opregion->rvda);
>  		opregion->rvda = NULL;
>  	}
> -	if (opregion->vbt_firmware) {
> -		kfree(opregion->vbt_firmware);
> -		opregion->vbt_firmware = NULL;
> -	}
> +	kfree(opregion->vbt_firmware);
> +	opregion->vbt_firmware = NULL;
>  	opregion->header = NULL;
>  	opregion->acpi = NULL;
>  	opregion->swsci = NULL;

-- 
Jani Nikula, Intel Open Source Technology Center

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ