[PATCH] Fixup NVidia

Hannes Reinecke <[email protected]>
Newsgroups gmane.linux.ataraid
Message-ID <[email protected]>
Hi Heinz,

the nvidia code has a off-by-one bug; it starts to check the possible
signatures from the _end_, but this is in fact set to the number of
possible signatures.
This is actually the reason why dmraid crashes on s390x.
Not that it's need there, but hey.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke			[email protected]
SuSE Linux Products GmbH		S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de

_______________________________________________
Ataraid-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/ataraid-list
dmraid_fixup_nvidia.diff (text/x-patch, 1.1 KB)
diff -pur dmraid/1.0.0.rc11.orig/lib/format/ataraid/nv.c dmraid/1.0.0.rc11/lib/format/ataraid/nv.c
--- dmraid/1.0.0.rc11.orig/lib/format/ataraid/nv.c	2006-03-23 13:33:00.000000000 +0100
+++ dmraid/1.0.0.rc11/lib/format/ataraid/nv.c	2006-08-10 16:20:07.000000000 +0200
@@ -151,7 +151,7 @@ static int set_sort(struct list_head *po
 static void to_cpu(void *meta)
 {
 	struct nv *nv = meta;
-	unsigned int i = NV_SIGNATURES;
+	unsigned int i;
 	struct nv_array_base *array = &nv->array;
 
 	CVT32(nv->size);
@@ -162,7 +162,7 @@ static void to_cpu(void *meta)
 	CVT32(nv->unitFlags);
 	CVT32(array->version);
 
-	while (i--);
+	for (i = 0; i < NV_SIGNATURES; i++);
 		CVT32(array->signature[i]);
 
 	CVT32(array->raidLevel);
@@ -221,15 +221,9 @@ static struct raid_dev *nv_read(struct l
 static int nv_write(struct lib_context *lc, struct raid_dev *rd, int erase)
 {
 	int ret;
-#if	BYTE_ORDER != LITTLE_ENDIAN
-	struct nv *nv = META(rd, nv);
 
-	to_disk(nv);
-#endif
 	ret = write_metadata(lc, handler, rd, -1, erase);
-#if	BYTE_ORDER != LITTLE_ENDIAN
-	to_cpu(nv);
-#endif
+
 	return ret;
 }
 
Nur in dmraid/1.0.0.rc11/lib/format/ataraid: nv.c~.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.