ANDROID: Incremental fs: Fix INCFS_MAGIC_NUMBER casts
Sparse complains about casting a five byte number to a ulong on 32-bit platorms. Fix by anding the constant with ULONG_MAX Bug: 186015158 Test: incfs_test passes, sparse reports no warnings on 32 & 64 bit builds Signed-off-by: Paul Lawrence <paullawrence@google.com> Change-Id: Ic83e03626b7f290370d75b3aaba187b8392fb344
This commit is contained in:
@@ -427,7 +427,7 @@ static inline struct inode_info *get_incfs_node(struct inode *inode)
|
||||
if (!inode)
|
||||
return NULL;
|
||||
|
||||
if (inode->i_sb->s_magic != (long) INCFS_MAGIC_NUMBER) {
|
||||
if (inode->i_sb->s_magic != INCFS_MAGIC_NUMBER) {
|
||||
/* This inode doesn't belong to us. */
|
||||
pr_warn_once("incfs: %s on an alien inode.", __func__);
|
||||
return NULL;
|
||||
|
||||
@@ -18,7 +18,14 @@
|
||||
|
||||
/* ===== constants ===== */
|
||||
#define INCFS_NAME "incremental-fs"
|
||||
#define INCFS_MAGIC_NUMBER (unsigned long)(0x5346434e49ul)
|
||||
|
||||
/*
|
||||
* Magic number used in file header and in memory superblock
|
||||
* Note that it is a 5 byte unsigned long. Thus on 32 bit kernels, it is
|
||||
* truncated to a 4 byte number
|
||||
*/
|
||||
#define INCFS_MAGIC_NUMBER (0x5346434e49ul & ULONG_MAX)
|
||||
|
||||
#define INCFS_DATA_FILE_BLOCK_SIZE 4096
|
||||
#define INCFS_HEADER_VER 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user