@@ -1184,7 +1184,7 @@ void __ref kmemleak_alloc_phys(phys_addr_t phys, size_t size, gfp_t gfp)
1184
1184
{
1185
1185
pr_debug ("%s(0x%pa, %zu)\n" , __func__ , & phys , size );
1186
1186
1187
- if (PHYS_PFN ( phys ) >= min_low_pfn && PHYS_PFN ( phys ) < max_low_pfn )
1187
+ if (kmemleak_enabled )
1188
1188
/*
1189
1189
* Create object with OBJECT_PHYS flag and
1190
1190
* assume min_count 0.
@@ -1204,7 +1204,7 @@ void __ref kmemleak_free_part_phys(phys_addr_t phys, size_t size)
1204
1204
{
1205
1205
pr_debug ("%s(0x%pa)\n" , __func__ , & phys );
1206
1206
1207
- if (PHYS_PFN ( phys ) >= min_low_pfn && PHYS_PFN ( phys ) < max_low_pfn )
1207
+ if (kmemleak_enabled )
1208
1208
delete_object_part ((unsigned long )phys , size , true);
1209
1209
}
1210
1210
EXPORT_SYMBOL (kmemleak_free_part_phys );
@@ -1218,7 +1218,7 @@ void __ref kmemleak_ignore_phys(phys_addr_t phys)
1218
1218
{
1219
1219
pr_debug ("%s(0x%pa)\n" , __func__ , & phys );
1220
1220
1221
- if (PHYS_PFN ( phys ) >= min_low_pfn && PHYS_PFN ( phys ) < max_low_pfn )
1221
+ if (kmemleak_enabled )
1222
1222
make_black_object ((unsigned long )phys , true);
1223
1223
}
1224
1224
EXPORT_SYMBOL (kmemleak_ignore_phys );
@@ -1493,6 +1493,17 @@ static void kmemleak_scan(void)
1493
1493
dump_object_info (object );
1494
1494
}
1495
1495
#endif
1496
+
1497
+ /* ignore objects outside lowmem (paint them black) */
1498
+ if ((object -> flags & OBJECT_PHYS ) &&
1499
+ !(object -> flags & OBJECT_NO_SCAN )) {
1500
+ unsigned long phys = object -> pointer ;
1501
+
1502
+ if (PHYS_PFN (phys ) < min_low_pfn ||
1503
+ PHYS_PFN (phys + object -> size ) >= max_low_pfn )
1504
+ __paint_it (object , KMEMLEAK_BLACK );
1505
+ }
1506
+
1496
1507
/* reset the reference count (whiten the object) */
1497
1508
object -> count = 0 ;
1498
1509
if (color_gray (object ) && get_object (object ))
0 commit comments