diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2021-05-07 12:26:39 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-05-07 11:30:44 +0200 |
commit | 93d2b3c4e8ccbb580a04f86eee6f66ea538afb28 (patch) | |
tree | de8fd009267b845738405d502acaddfb875a58ab /libpager | |
parent | ec5632b9ba7fe4666307e7210245f3aa2f25de88 (diff) | |
download | hurd-93d2b3c4e8ccbb580a04f86eee6f66ea538afb28.tar.gz hurd-93d2b3c4e8ccbb580a04f86eee6f66ea538afb28.tar.bz2 hurd-93d2b3c4e8ccbb580a04f86eee6f66ea538afb28.zip |
libpager: Properly zero-initialize pagemap
Unlike mmap () and calloc (), reallocarray () does not automatically
zero-fill the newly allocated memory. Do so explicitly.
Message-Id: <CAN9u=Hd21Es7Kc4tVBAUeLaKo9CWKO1e577TqnXMzmmvwLi22Q@mail.gmail.com>
Diffstat (limited to 'libpager')
-rw-r--r-- | libpager/pagemap.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libpager/pagemap.c b/libpager/pagemap.c index 7bbb8c56..c7c86d60 100644 --- a/libpager/pagemap.c +++ b/libpager/pagemap.c @@ -32,6 +32,8 @@ _pager_pagemap_resize (struct pager *p, vm_address_t off) if (!newaddr) return errno; + memset ((short *) newaddr + p->pagemapsize, 0, + (off - p->pagemapsize) * sizeof (*p->pagemap)); p->pagemap = newaddr; p->pagemapsize = off; } |