On Mon, Nov 13, 2017 at 10:19 AM, Dave Jiang <dave.ji...@intel.com> wrote:
> The size for mmap needs to be aligned to the region alignment. Fix the
> mapping size so that it satisfy the alignment requirement.
>
> Signed-off-by: Dave Jiang <dave.ji...@intel.com>
> ---
>  daxctl/io.c |   12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/daxctl/io.c b/daxctl/io.c
> index 2f8cb4a..e739d0e 100644
> --- a/daxctl/io.c
> +++ b/daxctl/io.c
> @@ -55,6 +55,7 @@ struct io_dev {
>         struct ndctl_region *region;
>         struct ndctl_dax *dax;
>         uint64_t size;
> +       uint64_t mmap_size;
>  };
>
>  static struct {
> @@ -83,6 +84,7 @@ static bool is_stdinout(struct io_dev *io_dev)
>  static int setup_device(struct io_dev *io_dev, size_t size)
>  {
>         int flags, rc;
> +       unsigned long align;
>
>         if (is_stdinout(io_dev))
>                 return 0;
> @@ -104,8 +106,14 @@ static int setup_device(struct io_dev *io_dev, size_t 
> size)
>         if (!io_dev->is_dax)
>                 return 0;
>
> +       align = ndctl_dax_get_align(io_dev->dax);
> +       if (align == ULLONG_MAX)

Isn't this always false because 'align' is 'unsigned long', not
'unsigned long long'?

Otherwise the rest of this looks good.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to