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] [thread-next>] [day] [month] [year] [list]
Message-id: <alpine.LFD.2.00.1002190026070.17638@localhost.localdomain>
Date:	Fri, 19 Feb 2010 00:27:46 -0500 (EST)
From:	Len Brown <lenb@...nel.org>
To:	Darren Jenkins <darrenrjenkins@...il.com>
Cc:	Zhang Rui <rui.zhang@...el.com>, Thomas Renninger <trenn@...e.de>,
	Alexey Dobriyan <adobriyan@...il.com>,
	Matthew Garrett <mjg@...hat.com>,
	linux ACPI <linux-acpi@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Kernel Janitors <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH] drivers: acpi: fan.c move a dereference below the NULL test

I think think this is a run-time check for a programming error,
and the current fashion is to delete the check and take a fault
if this happens so the caller can be fixed.

There are a couple of checks like this in fan.c --
perhaps Rui can clean them up when he comes back next week.

thanks,
Len Brown, Intel Open Source Technology Center

On Thu, 11 Feb 2010, Darren Jenkins wrote:

> In acpi_fan_remove() device is being dereferenced before the NULL test.
> This reorders the code to ensure it is checked for NULL first.
> 
> Coverity CID: 2758
> 
> Signed-off-by: Darren Jenkins <darrenrjenkins@...il.com>
> ---
>  drivers/acpi/fan.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
> index acf2ab2..dc39640 100644
> --- a/drivers/acpi/fan.c
> +++ b/drivers/acpi/fan.c
> @@ -298,9 +298,14 @@ static int acpi_fan_add(struct acpi_device *device)
>  
>  static int acpi_fan_remove(struct acpi_device *device, int type)
>  {
> -	struct thermal_cooling_device *cdev = acpi_driver_data(device);
> +	struct thermal_cooling_device *cdev;
> +
> +	if (!device)
> +		return -EINVAL;
> +
> +	cdev = acpi_driver_data(device);
>  
> -	if (!device || !cdev)
> +	if (!cdev)
>  		return -EINVAL;
>  
>  	acpi_fan_remove_fs(device);
> -- 
> 1.6.3.3
> 
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ