tree: git://git.cmpxchg.org/linux-mmotm.git master head: 7393732bae530daa27567988b91d16ecfeef6c62 commit: fe3e5c4f07cde4be67152518d21429bfbb875c0c [174/212] fat: use fat_fs_error() instead of BUG_ON() in __fat_get_block() config: i386-randconfig-a0-201822 (attached as .config) compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4 reproduce: git checkout fe3e5c4f07cde4be67152518d21429bfbb875c0c # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): fs/fat/inode.c: In function '__fat_get_block': >> fs/fat/inode.c:162:3: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'sector_t' [-Wformat=] fat_fs_error(sb, ^ vim +162 fs/fat/inode.c 111 112 static inline int __fat_get_block(struct inode *inode, sector_t iblock, 113 unsigned long *max_blocks, 114 struct buffer_head *bh_result, int create) 115 { 116 struct super_block *sb = inode->i_sb; 117 struct msdos_sb_info *sbi = MSDOS_SB(sb); 118 unsigned long mapped_blocks; 119 sector_t phys, last_block; 120 int err, offset; 121 122 err = fat_bmap(inode, iblock, &phys, &mapped_blocks, create, false); 123 if (err) 124 return err; 125 if (phys) { 126 map_bh(bh_result, sb, phys); 127 *max_blocks = min(mapped_blocks, *max_blocks); 128 return 0; 129 } 130 if (!create) 131 return 0; 132 133 if (iblock != MSDOS_I(inode)->mmu_private >> sb->s_blocksize_bits) { 134 fat_fs_error(sb, "corrupted file size (i_pos %lld, %lld)", 135 MSDOS_I(inode)->i_pos, MSDOS_I(inode)->mmu_private); 136 return -EIO; 137 } 138 139 last_block = inode->i_blocks >> (sb->s_blocksize_bits - 9); 140 offset = (unsigned long)iblock & (sbi->sec_per_clus - 1); 141 /* 142 * allocate a cluster according to the following. 143 * 1) no more available blocks 144 * 2) not part of fallocate region 145 */ 146 if (!offset && !(iblock < last_block)) { 147 /* TODO: multiple cluster allocation would be desirable. */ 148 err = fat_add_cluster(inode); 149 if (err) 150 return err; 151 } 152 /* available blocks on this cluster */ 153 mapped_blocks = sbi->sec_per_clus - offset; 154 155 *max_blocks = min(mapped_blocks, *max_blocks); 156 MSDOS_I(inode)->mmu_private += *max_blocks << sb->s_blocksize_bits; 157 158 err = fat_bmap(inode, iblock, &phys, &mapped_blocks, create, false); 159 if (err) 160 return err; 161 if (!phys) { > 162 fat_fs_error(sb, 163 "invalid FAT chain (i_pos %lld, last_block %ld)", 164 MSDOS_I(inode)->i_pos, last_block); 165 return -EIO; 166 } 167 168 BUG_ON(*max_blocks != mapped_blocks); 169 set_buffer_new(bh_result); 170 map_bh(bh_result, sb, phys); 171 172 return 0; 173 } 174 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation