kernel: mmu: Fix possible null de-reference
virt_page_phys_get can be called with phy parameter NULL when the intention is just checking if a virtual address is mapped. This function is generally overwritten by a an arch API that checks if phys is null before using it but this default implementation doesn't. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
471cff50e8
commit
a36c016dff
|
@ -469,7 +469,9 @@ static int virt_to_page_frame(void *virt, uintptr_t *phys)
|
||||||
if (z_page_frame_is_mapped(pf)) {
|
if (z_page_frame_is_mapped(pf)) {
|
||||||
if (virt == pf->addr) {
|
if (virt == pf->addr) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
*phys = z_page_frame_to_phys(pf);
|
if (phys != NULL) {
|
||||||
|
*phys = z_page_frame_to_phys(pf);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue