Re: [PATCH] PCI/P2PDMA: Annotate RCU dereference

From: Chaitanya Kulkarni
Date: Thu Feb 09 2023 - 12:53:29 EST


On 2/9/23 09:29, Logan Gunthorpe wrote:
> A dereference of the __rcu pointer was noticed by sparse:
>
> drivers/pci/p2pdma.c:199:44: sparse: sparse: dereference of noderef expression
>
> The __rcu pointer should be dereferenced using
> rcu_dereference_protected() instead of accessed directly. Its safe
> to use rcu_derference_protected() seeing a reference is held on
> the pgmap's percpu reference counter and thus it cannot disappear.
>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Signed-off-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>
> ---

I believe that this change removes the warning is question.

With that said, looks good.

Reviewed-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>

-ck