]> git.ameliathe1st.gay Git - voyage-au-centre-des-fichiers.git/commitdiff
Made the physical pages returned by the allocator null, to avoid any unexpected bugs...
authorAmelia Coutard <eliottulio.coutard@gmail.com>
Thu, 13 Oct 2022 14:45:51 +0000 (16:45 +0200)
committerAmelia Coutard <eliottulio.coutard@gmail.com>
Thu, 13 Oct 2022 14:45:51 +0000 (16:45 +0200)
src/paging.cpp

index eeef6903a3607bac01260ddee246864a5ff1ceb5..302a67577c4babe468842106a3c601120e22bf1d 100644 (file)
@@ -73,12 +73,18 @@ os::paging::page_allocator_t::block os::paging::page_allocator_t::allocate(std::
        for (auto it = begin(); it != end(); it = it->next) {
                if (count == it->size) {
                        erase(it);
+                       for (std::size_t i = 0; i < count * 0x1000; i++) {
+                               phys_ptr<char>(it.get_phys_addr())[i] = 0;
+                       }
                        return {
                                .ptr = phys_ptr<paging::page>(it.get_phys_addr()),
                                .size = count,
                        };
                } else if (count < it->size) {
                        erase(split_at_offset(it, count));
+                       for (std::size_t i = 0; i < count * 0x1000; i++) {
+                               phys_ptr<char>(it.get_phys_addr())[i] = 0;
+                       }
                        return {
                                .ptr = phys_ptr<paging::page>(it.get_phys_addr()),
                                .size = count,