[PATCH] DAC960 Stanford Checker fix

From: Dave Olien (dmo@osdl.org)
Date: Thu Feb 06 2003 - 17:36:37 EST


This was found by the Standford Checker.
The LogicalDeviceNumber bad range test was changed from > to >=
I also replaced a couple of panic() calls with error messages,
since panic-ing seemed a little extreme.

---------------------------------------------------------------------------

diff -ur linux-2.5.59_original/drivers/block/DAC960.c linux-2.5.59_DAC_Logical_Dev/drivers/block/DAC960.c
--- linux-2.5.59_original/drivers/block/DAC960.c 2003-01-16 18:22:28.000000000 -0800
+++ linux-2.5.59_DAC_Logical_Dev/drivers/block/DAC960.c 2003-01-28 16:36:02.000000000 -0800
@@ -1729,12 +1729,17 @@
       if (!DAC960_V2_NewLogicalDeviceInfo(Controller, LogicalDeviceNumber))
         break;
       LogicalDeviceNumber = NewLogicalDeviceInfo->LogicalDeviceNumber;
- if (LogicalDeviceNumber > DAC960_MaxLogicalDrives)
- panic("DAC960: Logical Drive Number %d not supported\n",
- LogicalDeviceNumber);
- if (NewLogicalDeviceInfo->DeviceBlockSizeInBytes != DAC960_BlockSize)
- panic("DAC960: Logical Drive Block Size %d not supported\n",
- NewLogicalDeviceInfo->DeviceBlockSizeInBytes);
+ if (LogicalDeviceNumber >= DAC960_MaxLogicalDrives) {
+ DAC960_Error("DAC960: Logical Drive Number %d not supported\n",
+ Controller, LogicalDeviceNumber);
+ break;
+ }
+ if (NewLogicalDeviceInfo->DeviceBlockSizeInBytes != DAC960_BlockSize) {
+ DAC960_Error("DAC960: Logical Drive Block Size %d not supported\n",
+ Controller, NewLogicalDeviceInfo->DeviceBlockSizeInBytes);
+ LogicalDeviceNumber++;
+ continue;
+ }
       PhysicalDevice.Controller = 0;
       PhysicalDevice.Channel = NewLogicalDeviceInfo->Channel;
       PhysicalDevice.TargetID = NewLogicalDeviceInfo->TargetID;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Feb 07 2003 - 22:00:22 EST