diff options
author | Stefan Kempf <stefan@cvs.openbsd.org> | 2016-02-08 17:21:11 +0000 |
---|---|---|
committer | Stefan Kempf <stefan@cvs.openbsd.org> | 2016-02-08 17:21:11 +0000 |
commit | 8327c06f4eee4dd10165995a9f2e42070cdd1812 (patch) | |
tree | dcc6c22e1a4c3ca0db70e3e8240965a317f713c1 /sys | |
parent | 2abb53e43ab9531afacc065b3fc4ffee1fa38b49 (diff) |
Convert to uiomove. From Martin Natano.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/video.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/dev/video.c b/sys/dev/video.c index 5a4357fde59..c21e1855cb9 100644 --- a/sys/dev/video.c +++ b/sys/dev/video.c @@ -1,4 +1,4 @@ -/* $OpenBSD: video.c,v 1.37 2015/08/29 20:51:46 deraadt Exp $ */ +/* $OpenBSD: video.c,v 1.38 2016/02/08 17:21:10 stefan Exp $ */ /* * Copyright (c) 2008 Robert Nagy <robert@openbsd.org> @@ -136,7 +136,8 @@ int videoread(dev_t dev, struct uio *uio, int ioflag) { struct video_softc *sc; - int unit, error, size; + int unit, error; + size_t size; unit = VIDEOUNIT(dev); if (unit >= video_cd.cd_ndevs || @@ -169,16 +170,13 @@ videoread(dev_t dev, struct uio *uio, int ioflag) } /* move no more than 1 frame to userland, as per specification */ - if (sc->sc_fsize < uio->uio_resid) - size = sc->sc_fsize; - else - size = uio->uio_resid; - error = uiomovei(sc->sc_fbuffer, size, uio); + size = ulmin(uio->uio_resid, sc->sc_fsize); + error = uiomove(sc->sc_fbuffer, size, uio); sc->sc_frames_ready--; if (error) return (error); - DPRINTF(("uiomove successfully done (%d bytes)\n", size)); + DPRINTF(("uiomove successfully done (%zu bytes)\n", size)); return (0); } |