Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pad pad(4): Do harmless, not harmful, integer trunca...



details:   https://anonhg.NetBSD.org/src/rev/08363a561520
branches:  trunk
changeset: 363441:08363a561520
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Mar 12 17:07:10 2022 +0000

description:
pad(4): Do harmless, not harmful, integer truncation.

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

diffstat:

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

diffs (27 lines):

diff -r 61845206095d -r 08363a561520 sys/dev/pad/pad.c
--- a/sys/dev/pad/pad.c Sat Mar 12 16:57:15 2022 +0000
+++ b/sys/dev/pad/pad.c Sat Mar 12 17:07:10 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.75 2021/06/14 18:44:53 riastradh Exp $ */
+/* $NetBSD: pad.c,v 1.76 2022/03/12 17:07:10 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.75 2021/06/14 18:44:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.76 2022/03/12 17:07:10 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -506,7 +506,7 @@
        DPRINTF("%s: resid=%zu\n", __func__, uio->uio_resid);
        while (uio->uio_resid > 0) {
                mutex_enter(&sc->sc_intr_lock);
-               err = pad_get_block(sc, &pb, uio->uio_resid);
+               err = pad_get_block(sc, &pb, MIN(uio->uio_resid, INT_MAX));
                mutex_exit(&sc->sc_intr_lock);
                if (err)
                        break;



Home | Main Index | Thread Index | Old Index