Module Name:    src
Committed By:   riastradh
Date:           Sun Mar 13 18:37:10 UTC 2022

Modified Files:
        src/sys/kern: kern_physio.c

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

Reported-by: syzbot+13abd9bc700f7ceac...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/kern/kern_physio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_physio.c
diff -u src/sys/kern/kern_physio.c:1.99 src/sys/kern/kern_physio.c:1.100
--- src/sys/kern/kern_physio.c:1.99	Thu Sep 16 22:19:11 2021
+++ src/sys/kern/kern_physio.c	Sun Mar 13 18:37:10 2022
@@ -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 @@ physio(void (*strategy)(struct buf *), s
 				 */
 				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;
 

Reply via email to