diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index 1282ad089cbf9f01a8fec85ffef40ba3e1ad5f29..17173edf8f5857f18625e9d4fa08a5d6e8ad21ca 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.610 2007/04/17 21:10:59 chrfranke Exp $
+$Id: CHANGELOG,v 1.611 2007/04/20 20:41:00 shattered Exp $
 
 The most recent version of this file is:
 http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup
@@ -33,6 +33,8 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [SS] CCISS physical drive enumeration method changed (incompatibly).
+
   [CF] Fixed smartd crash on missing '-s' directive argument.
 
   [SS] Support CCISS on FreeBSD (kernel source is required).
diff --git a/sm5/cciss.cpp b/sm5/cciss.cpp
index b947ca9feeba0b52174c6a1bf8be68c5a9d88104..f81ab2cee3c0d6d45ab01ac09b7d107caec41137 100644
--- a/sm5/cciss.cpp
+++ b/sm5/cciss.cpp
@@ -13,7 +13,10 @@
 #    include <linux/cciss_ioctl.h>
 #    define _HAVE_CCISS
 #  endif
+#  include <asm/byteorder.h>
+#  define be32toh __be32_to_cpu
 #elif defined(__FreeBSD__) && defined(HAVE_DEV_CISS_CISSIO_H)
+#  include <sys/endian.h>
 #  include <dev/ciss/cissio.h>
 #  define _HAVE_CCISS
 #endif
@@ -25,7 +28,7 @@
 
 typedef struct _ReportLUNdata_struct
 {
-  uint8_t LUNListLength[4];
+  uint32_t LUNListLength;	/* always big-endian */
   uint32_t reserved;
   uint8_t LUN[CISS_MAX_LUN][8];
 } ReportLunData_struct;
@@ -209,6 +212,7 @@ static int cciss_getlun(int device, int target, unsigned char *physlun, int repo
       pout("===== [%s] DATA END (%d Bytes) =====\n\n", "LUN DATA", sizeof(_ReportLUNdata_struct));
     }
 
+#if 0
     for (i=0; i<CISS_MAX_LUN; i++) 
     {
         if (luns->LUN[i][6] == target) 
@@ -218,6 +222,14 @@ static int cciss_getlun(int device, int target, unsigned char *physlun, int repo
             return 0;
         }
     }
+#else
+    if (target >= 0 && target < (int) be32toh(luns->LUNListLength) / 8)
+    {
+	memcpy(physlun, luns->LUN[target], 8);
+	free(luns);
+	return 0;
+    }
+#endif
 
     free(luns);
     return 1;