diff --git a/drivers/dax/fsdev.c b/drivers/dax/fsdev.c index 57c589e19b53..d50891d6dc13 100644 --- a/drivers/dax/fsdev.c +++ b/drivers/dax/fsdev.c @@ -342,8 +342,12 @@ static int fsdev_dax_probe(struct dev_dax *dev_dax) u64 phys = dev_dax->ranges[0].range.start; u64 pgmap_phys = pgmap[0].range.start; - if (!WARN_ON(pgmap_phys > phys)) - data_offset = phys - pgmap_phys; + if (pgmap_phys > phys) { + dev_err(dev, "pgmap start %#llx exceeds data start %#llx\n", + pgmap_phys, phys); + return -EINVAL; + } + data_offset = phys - pgmap_phys; pr_debug("%s: offset detected phys=%llx pgmap_phys=%llx offset=%llx\n", __func__, phys, pgmap_phys, data_offset);