Re: [PATCH] dax/kmem: Pass valid argument to memory_group_register_static

From: Alison Schofield
Date: Tue Jun 20 2023 - 19:21:57 EST


On Tue, Jun 20, 2023 at 07:33:32PM +0530, Tarun Sahu wrote:
> memory_group_register_static takes maximum number of pages as the argument
> while dev_dax_kmem_probe passes total_len (in bytes) as the argument.

This sounds like a fix. An explanation of the impact and a fixes tag
may be needed. Also, wondering how you found it.

Alison

>
> Signed-off-by: Tarun Sahu <tsahu@xxxxxxxxxxxxx>
> ---
> drivers/dax/kmem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
> index 7b36db6f1cbd..898ca9505754 100644
> --- a/drivers/dax/kmem.c
> +++ b/drivers/dax/kmem.c
> @@ -99,7 +99,7 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax)
> if (!data->res_name)
> goto err_res_name;
>
> - rc = memory_group_register_static(numa_node, total_len);
> + rc = memory_group_register_static(numa_node, PFN_UP(total_len));
> if (rc < 0)
> goto err_reg_mgid;
> data->mgid = rc;
> --
> 2.31.1
>