Source-Changes-HG archive

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

[src/trunk]: src/sys/kern kern: Use harmless, not harmful, integer truncation...



details:   https://anonhg.NetBSD.org/src/rev/c90291d61cce
branches:  trunk
changeset: 363492:c90291d61cce
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Mar 13 18:37:10 2022 +0000

description:
kern: Use harmless, not harmful, integer truncation in physio.

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

diffstat:

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

diffs (27 lines):

diff -r 5edbcd8a69dd -r c90291d61cce sys/kern/kern_physio.c
--- a/sys/kern/kern_physio.c    Sun Mar 13 17:52:45 2022 +0000
+++ b/sys/kern/kern_physio.c    Sun Mar 13 18:37:10 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_physio.c,v 1.99 2021/09/16 22:19:11 andvar Exp $  */
+/*     $NetBSD: kern_physio.c,v 1.100 2022/03/13 18:37:10 riastradh Exp $      */
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_physio.c,v 1.99 2021/09/16 22:19:11 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_physio.c,v 1.100 2022/03/13 18:37:10 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -317,7 +317,7 @@
                                 */
                                bp->b_bcount = MIN(MAXPHYS, iovp->iov_len);
                        } else {
-                               bp->b_bcount = iovp->iov_len;
+                               bp->b_bcount = MIN(INT_MAX, iovp->iov_len);
                        }
                        bp->b_data = iovp->iov_base;
 



Home | Main Index | Thread Index | Old Index