[PATCH 3/4] libsensors4: Fix corner case bug in sensors_substitute_chip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jean Delvare wrote:
> Contrary to what the comment says, sensors_proc_bus_count may be a
> perfectly valid bus number. We need to use a different value for
> chip configuration entries we want to ignore.
> 

Looks good to me, can you commit these to svn before the end of the weekend, 
monday I'll be back at work and there I have several machines to test with, so 
if you can get all your changes into svn before monday then I can give svn a 
good testing with various setups @ work.

Regards,

Hans


> ---
>  lib/data.c    |    8 ++++----
>  lib/sensors.h |    1 +
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> --- lm-sensors-3.orig/lib/data.c	2007-08-17 10:53:33.000000000 +0200
> +++ lm-sensors-3/lib/data.c	2007-08-17 10:57:46.000000000 +0200
> @@ -192,7 +192,7 @@ int sensors_substitute_chip(sensors_chip
>  
>  	if (i == sensors_config_busses_count) {
>  		sensors_parse_error("Undeclared bus id referenced", lineno);
> -		name->bus.nr = sensors_proc_bus_count;
> +		name->bus.nr = SENSORS_BUS_NR_IGNORE;
>  		return -SENSORS_ERR_BUS_NAME;
>  	}
>  
> @@ -205,9 +205,9 @@ int sensors_substitute_chip(sensors_chip
>  		}
>  	}
>  
> -	/* We did not find anything. sensors_proc_bus_count is not
> -	   a valid bus number, so it will never be matched. Good. */
> -	name->bus.nr = sensors_proc_bus_count;
> +	/* We did not find a matching bus name, simply ignore this chip
> +	   config entry. */
> +	name->bus.nr = SENSORS_BUS_NR_IGNORE;
>  	return 0;
>  }
>  
> --- lm-sensors-3.orig/lib/sensors.h	2007-08-17 09:24:35.000000000 +0200
> +++ lm-sensors-3/lib/sensors.h	2007-08-17 10:57:46.000000000 +0200
> @@ -34,6 +34,7 @@
>  #define SENSORS_BUS_TYPE_ISA	1
>  #define SENSORS_BUS_TYPE_PCI	2
>  #define SENSORS_BUS_NR_ANY	(-1)
> +#define SENSORS_BUS_NR_IGNORE	(-2)
>  
>  #ifdef __cplusplus
>  extern "C" {
> 
> 





[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux