Skip to contentSkip to conversation

drivers/md/raid6algos.c: fix a NULL dereference

PATCH New Adrian Bunk 1 participant 1 message Apr 27, 2006 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/md/raid6algos.c: fix a NULL dereference

This patch fixes a NULL dereference spotted by the Coverity checker.

---

 drivers/md/raid6algos.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/md/raid6algos.c renamed from drivers/md/raid6algos.c.old +3 -4
@@ -139,15 +139,14 @@ int __init raid6_select_algo(void)
 		}
 	}
 
-	if ( best )
+	if (best) {
 		printk("raid6: using algorithm %s (%ld MB/s)\n",
 		       best->name,
 		       (bestperf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2));
-	else
+		raid6_call = *best;
+	} else
 		printk("raid6: Yikes!  No algorithm found!\n");
 
-	raid6_call = *best;
-
 	free_pages((unsigned long)syndromes, 1);
 
 	return best ? 0 : -EINVAL;