Skip to content

Commit

Permalink
dax: Ensure errno is returned from dax_direct_access
Browse files Browse the repository at this point in the history
If the caller specifies a negative nr_pages that is an invalid
parameter.

Return -EINVAL to ensure callers get an errno if they want to check it.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20210525172428.3634316-4-ira.weiny@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
weiny2 authored and djbw committed Jul 8, 2021
1 parent 4478859 commit b05d4c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/dax/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
return -ENXIO;

if (nr_pages < 0)
return nr_pages;
return -EINVAL;

avail = dax_dev->ops->direct_access(dax_dev, pgoff, nr_pages,
kaddr, pfn);
Expand Down

0 comments on commit b05d4c5

Please sign in to comment.