Whamcloud - gitweb
Check "sbi->s_mb_history" before using it.
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext3-mballoc3-core.patch
index 378d37f..9f8f7e3 100644 (file)
@@ -183,7 +183,7 @@ Index: linux-2.6.9-full/fs/ext3/mballoc.c
 ===================================================================
 --- linux-2.6.9-full.orig/fs/ext3/mballoc.c    2007-07-14 04:24:39.138985848 +0400
 +++ linux-2.6.9-full/fs/ext3/mballoc.c 2007-07-20 11:31:03.000000000 +0400
-@@ -0,0 +1,4391 @@
+@@ -0,0 +1,4392 @@
 +/*
 + * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com
 + * Written by Alex Tomas <alex@clusterfs.com>
@@ -2388,7 +2388,8 @@ Index: linux-2.6.9-full/fs/ext3/mballoc.c
 +      spin_lock_init(&sbi->s_mb_history_lock);
 +      i = sbi->s_mb_history_max * sizeof(struct ext3_mb_history);
 +      sbi->s_mb_history = kmalloc(i, GFP_KERNEL);
-+      memset(sbi->s_mb_history, 0, i);
++       if (likely(sbi->s_mb_history != NULL))
++               memset(sbi->s_mb_history, 0, i);
 +      /* if we can't allocate history, then we simple won't use it */
 +}
 +
@@ -2398,7 +2399,7 @@ Index: linux-2.6.9-full/fs/ext3/mballoc.c
 +      struct ext3_sb_info *sbi = EXT3_SB(ac->ac_sb);
 +      struct ext3_mb_history h;
 +
-+      if (likely(sbi->s_mb_history == NULL))
++      if (unlikely(sbi->s_mb_history == NULL))
 +              return;
 +
 +      if (!(ac->ac_op & sbi->s_mb_history_filter))