summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-05-11 01:56:27 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-05-11 01:56:27 +0000
commitb48c586ed6aa45bab5089fdd83c9934cd266170d (patch)
tree27a6bdc1bc8e94e3d3ec0064df775555c0212f9e /sys/arch
parentb8616fd26363ce287e8014cf0c2f2a5f5a8d3cf1 (diff)
Convert from uiomovei() to uiomove() to prevent short tranfers
diff from natano@bitrig, with some additional format and cast tweaks
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/nvram.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/arch/amd64/amd64/nvram.c b/sys/arch/amd64/amd64/nvram.c
index c3aa137e234..3cdb28beed1 100644
--- a/sys/arch/amd64/amd64/nvram.c
+++ b/sys/arch/amd64/amd64/nvram.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvram.c,v 1.3 2015/03/14 03:38:46 jsg Exp $ */
+/* $OpenBSD: nvram.c,v 1.4 2015/05/11 01:56:26 guenther Exp $ */
/*
* Copyright (c) 2004 Joshua Stein <jcs@openbsd.org>
@@ -94,7 +94,7 @@ nvramread(dev_t dev, struct uio *uio, int flags)
u_char buf[NVRAM_SIZE];
u_int pos = uio->uio_offset;
u_char *tmp;
- int count = min(sizeof(buf), uio->uio_resid);
+ size_t count = ulmin(sizeof(buf), uio->uio_resid);
int ret;
if (!nvram_initialized)
@@ -104,17 +104,17 @@ nvramread(dev_t dev, struct uio *uio, int flags)
return (0);
#ifdef NVRAM_DEBUG
- printf("attempting to read %d bytes at offset %d\n", count, pos);
+ printf("attempting to read %zu bytes at offset %d\n", count, pos);
#endif
for (tmp = buf; count-- > 0 && pos < NVRAM_SIZE; ++pos, ++tmp)
*tmp = nvram_get_byte(pos);
#ifdef NVRAM_DEBUG
- printf("nvramread read %d bytes (%s)\n", (tmp - buf), tmp);
+ printf("nvramread read %td bytes (%s)\n", (tmp - buf), tmp);
#endif
- ret = uiomovei((caddr_t)buf, (tmp - buf), uio);
+ ret = uiomove(buf, (tmp - buf), uio);
uio->uio_offset += uio->uio_resid;