Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Fix integer overflow when printing available memory...



details:   https://anonhg.NetBSD.org/src/rev/afb50ee85cb5
branches:  trunk
changeset: 967784:afb50ee85cb5
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Dec 22 15:00:42 2019 +0000

description:
Fix integer overflow when printing available memory size (resulting from
a cast lost during merges).

Reported-by: syzbot+f02ca5f83ac7196b8afd%syzkaller.appspotmail.com@localhost

diffstat:

 sys/kern/init_main.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (26 lines):

diff -r ce5ac0366c19 -r afb50ee85cb5 sys/kern/init_main.c
--- a/sys/kern/init_main.c      Sun Dec 22 13:16:09 2019 +0000
+++ b/sys/kern/init_main.c      Sun Dec 22 15:00:42 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_main.c,v 1.511 2019/12/21 13:00:24 ad Exp $       */
+/*     $NetBSD: init_main.c,v 1.512 2019/12/22 15:00:42 ad Exp $       */
 
 /*-
  * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.511 2019/12/21 13:00:24 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.512 2019/12/22 15:00:42 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -1174,6 +1174,6 @@
        (*pr)("%s%s", copyright, version);
        format_bytes(pbuf, MEM_PBUFSIZE, ctob((uint64_t)physmem));
        (*pr)("total memory = %s\n", pbuf);
-       format_bytes(pbuf, MEM_PBUFSIZE, ctob(uvm_free()));
+       format_bytes(pbuf, MEM_PBUFSIZE, ctob((uint64_t)uvm_free()));
        (*pr)("avail memory = %s\n", pbuf);
 }



Home | Main Index | Thread Index | Old Index