Don't dereference em if it's NULL or an error pointer.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
read_lock(&em_tree->lock);
em = lookup_extent_mapping(em_tree, start, failrec->len);
- if (em->start > start || em->start + em->len < start) {
+ if (em && !IS_ERR(em) && (em->start > start ||
+ em->start + em->len < start)) {
free_extent_map(em);
em = NULL;
}