-------- Original Message  --------
Subject: Re: [PATCH v2 1/2] btrfs: Fix superblock csum type check.
From: David Sterba <dste...@suse.cz>
To: Qu Wenruo <quwen...@cn.fujitsu.com>
Date: 2015年04月24日 23:05

On Fri, Apr 24, 2015 at 09:12:40AM +0800, Qu Wenruo wrote:
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -173,6 +173,7 @@ struct btrfs_ordered_sum;

  /* csum types */
  #define BTRFS_CSUM_TYPE_CRC32 0
+#define BTRFS_CSUM_LAST_TYPE   0

  static int btrfs_csum_sizes[] = { 4, 0 };

I'd prefer to fix it by removing the 0 from btrfs_csum_sizes instead of
introducing a define.


Removing the zero seems not help for this case, as some one can still
craft a strange csum_type to access outside the array.

So I introduce the new macro and use the new macro to compare with csum_type without acess the array.

Thanks,
Qu
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to