Skip to content

Commit

Permalink
mm/memremap: avoid calling kasan_remove_zero_shadow() for device priv…
Browse files Browse the repository at this point in the history
…ate memory

For device private memory, we do not create a linear mapping for the
memory because the device memory is un-accessible.  Thus we do not add
kasan zero shadow for it.  So it's unnecessary to do
kasan_remove_zero_shadow() for it.

Link: https://lkml.kernel.org/r/20220126092602.1425-1-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
MiaoheLin authored and torvalds committed Mar 22, 2022
1 parent a128b05 commit a74c6c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/memremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ static int pagemap_range(struct dev_pagemap *pgmap, struct mhp_params *params,
return 0;

err_add_memory:
kasan_remove_zero_shadow(__va(range->start), range_len(range));
if (!is_private)
kasan_remove_zero_shadow(__va(range->start), range_len(range));
err_kasan:
untrack_pfn(NULL, PHYS_PFN(range->start), range_len(range));
err_pfn_remap:
Expand Down

0 comments on commit a74c6c0

Please sign in to comment.