@@ -71,6 +71,9 @@ enum {
#define EROFS_I_VERSION_BIT 0
__EROFS_BIT(EROFS_I_, DATA_MAPPING, VERSION);
+#define EROFS_I_ALL \
+ ((1 << (EROFS_I_DATA_MAPPING_BIT + EROFS_I_DATA_MAPPING_BITS)) - 1)
+
struct erofs_inode_v1 {
/* 0 */__le16 i_advise;
@@ -48,6 +48,12 @@ static struct page *read_inode(struct in
v1 = page_address(page) + *ofs;
ifmt = le16_to_cpu(v1->i_advise);
+ if (ifmt & ~EROFS_I_ALL) {
+ errln("unsupported i_format %u of nid %llu", ifmt, vi->nid);
+ err = -EOPNOTSUPP;
+ goto err_out;
+ }
+
vi->data_mapping_mode = __inode_data_mapping(ifmt);
if (unlikely(vi->data_mapping_mode >= EROFS_INODE_LAYOUT_MAX)) {
errln("unknown data mapping mode %u of nid %llu",