diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 8a7798d7f5fc..2f2634baa285 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c @@ -1997,10 +1997,7 @@ int ntfs_read_inode_mount(struct inode *vi) /* Catch the end of the attribute list. */ if ((u8 *)al_entry == al_end) goto em_put_err_out; - if (!al_entry->length) - goto em_put_err_out; - if ((u8 *)al_entry + 6 > al_end || - (u8 *)al_entry + le16_to_cpu(al_entry->length) > al_end) + if (!ntfs_attr_list_entry_is_valid(al_entry, al_end)) goto em_put_err_out; next_al_entry = (struct attr_list_entry *)((u8 *)al_entry + le16_to_cpu(al_entry->length));