Skip to content

Commit

Permalink
fix: memset() called to fill 0 bytes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjwang committed Jan 18, 2025
1 parent 653afa9 commit 0f39fd4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kernel/base/kmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void *kmalloc_chunk(uint64_t size, const char *func, uint64_t line)
}

/* TODO: for final release, this should be removed to improve speed */
memset(alloc, size + PAGE_SIZE, 0);
memset(alloc, 0, size + PAGE_SIZE);

alloc->magic = MEM_MAGIC_NUM;
alloc->checkno = kmalloc_checkno;
Expand Down
2 changes: 1 addition & 1 deletion kernel/device/display/fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void fb_init(fb_info_t *fb, struct limine_framebuffer* s)
fb->backbuffer_len = fb->height * fb->pitch;
fb->backbuffer = fb->addr;

memset(&(fb->img_bg), sizeof(image_t), 0);;
memset(&(fb->img_bg), 0, sizeof(image_t));

for(uint32_t x = 0; x < fb->width; x++) {
for(uint32_t y = 0; y < fb->height; y++) {
Expand Down
2 changes: 1 addition & 1 deletion kernel/proc/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ int k_getrusage(int64_t who, uint64_t usage) {
* gcc to know the purpose of this function call.
*/
klogw("SYSCALL: get 0x%x rusage\n", who);
memset(u, sizeof(rusage_t), 0);
memset(u, 0, sizeof(rusage_t));

return 0;
}
Expand Down

0 comments on commit 0f39fd4

Please sign in to comment.