Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/procfs fix sign-compare issues: uio->uio_offset (...
details: https://anonhg.NetBSD.org/src/rev/35f8371360f6
branches: trunk
changeset: 1003705:35f8371360f6
user: christos <christos%NetBSD.org@localhost>
date: Thu Sep 26 17:34:08 2019 +0000
description:
fix sign-compare issues: uio->uio_offset (off_t) is compared with (size_t):
cast the offset to size_t.
diffstat:
sys/miscfs/procfs/procfs_auxv.c | 6 +++---
sys/miscfs/procfs/procfs_cmdline.c | 10 +++++-----
sys/miscfs/procfs/procfs_limit.c | 6 +++---
sys/miscfs/procfs/procfs_map.c | 6 +++---
sys/miscfs/procfs/procfs_subr.c | 6 +++---
5 files changed, 17 insertions(+), 17 deletions(-)
diffs (151 lines):
diff -r d0efd6d00dd9 -r 35f8371360f6 sys/miscfs/procfs/procfs_auxv.c
--- a/sys/miscfs/procfs/procfs_auxv.c Thu Sep 26 17:33:18 2019 +0000
+++ b/sys/miscfs/procfs/procfs_auxv.c Thu Sep 26 17:34:08 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_auxv.c,v 1.2 2017/03/30 20:21:00 christos Exp $ */
+/* $NetBSD: procfs_auxv.c,v 1.3 2019/09/26 17:34:08 christos Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_auxv.c,v 1.2 2017/03/30 20:21:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_auxv.c,v 1.3 2019/09/26 17:34:08 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -52,7 +52,7 @@
if ((error = proc_getauxv(p, &buffer, &bufsize)) != 0)
return error;
- if (uio->uio_offset < bufsize)
+ if ((size_t)uio->uio_offset < bufsize)
error = uiomove((char *)buffer + uio->uio_offset,
bufsize - uio->uio_offset, uio);
else
diff -r d0efd6d00dd9 -r 35f8371360f6 sys/miscfs/procfs/procfs_cmdline.c
--- a/sys/miscfs/procfs/procfs_cmdline.c Thu Sep 26 17:33:18 2019 +0000
+++ b/sys/miscfs/procfs/procfs_cmdline.c Thu Sep 26 17:34:08 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_cmdline.c,v 1.30 2017/12/31 03:29:18 christos Exp $ */
+/* $NetBSD: procfs_cmdline.c,v 1.31 2019/09/26 17:34:08 christos Exp $ */
/*
* Copyright (c) 1999 Jaromir Dolecek <dolecek%ics.muni.cz@localhost>
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_cmdline.c,v 1.30 2017/12/31 03:29:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_cmdline.c,v 1.31 2019/09/26 17:34:08 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -52,7 +52,7 @@
char *buf = __UNCONST(src);
buf += uio->uio_offset - off;
- if (off + len <= uio->uio_offset)
+ if (off + len <= (size_t)uio->uio_offset)
return 0;
return uiomove(buf, off + len - uio->uio_offset, cookie);
}
@@ -90,13 +90,13 @@
return error;
}
len = strlen(p->p_comm);
- if (len >= uio->uio_offset) {
+ if (len >= (size_t)uio->uio_offset) {
start = uio->uio_offset - 1;
error = uiomove(p->p_comm + start, len - start, uio);
if (error)
return error;
}
- if (len + 2 >= uio->uio_offset) {
+ if (len + 2 >= (size_t)uio->uio_offset) {
start = uio->uio_offset - 1 - len;
error = uiomove(msg + 1 + start, 2 - start, uio);
}
diff -r d0efd6d00dd9 -r 35f8371360f6 sys/miscfs/procfs/procfs_limit.c
--- a/sys/miscfs/procfs/procfs_limit.c Thu Sep 26 17:33:18 2019 +0000
+++ b/sys/miscfs/procfs/procfs_limit.c Thu Sep 26 17:34:08 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_limit.c,v 1.1 2019/03/30 23:28:30 christos Exp $ */
+/* $NetBSD: procfs_limit.c,v 1.2 2019/09/26 17:34:08 christos Exp $ */
/*-
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_limit.c,v 1.1 2019/03/30 23:28:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_limit.c,v 1.2 2019/09/26 17:34:08 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -81,7 +81,7 @@
pos += prl(buffer + pos, bufsize - pos, rl[i].rlim_max, '\n');
}
- if (uio->uio_offset < pos)
+ if ((size_t)uio->uio_offset < pos)
error = uiomove(buffer + uio->uio_offset,
pos - uio->uio_offset, uio);
else
diff -r d0efd6d00dd9 -r 35f8371360f6 sys/miscfs/procfs/procfs_map.c
--- a/sys/miscfs/procfs/procfs_map.c Thu Sep 26 17:33:18 2019 +0000
+++ b/sys/miscfs/procfs/procfs_map.c Thu Sep 26 17:34:08 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_map.c,v 1.45 2014/10/17 20:49:22 christos Exp $ */
+/* $NetBSD: procfs_map.c,v 1.46 2019/09/26 17:34:08 christos Exp $ */
/*
* Copyright (c) 1993
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_map.c,v 1.45 2014/10/17 20:49:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_map.c,v 1.46 2019/09/26 17:34:08 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -216,7 +216,7 @@
* The map could have changed between the two reads, and
* that could result in junk, but typically it does not.
*/
- if (uio->uio_offset < pos)
+ if ((size_t)uio->uio_offset < pos)
error = uiomove(buffer + uio->uio_offset,
pos - uio->uio_offset, uio);
else
diff -r d0efd6d00dd9 -r 35f8371360f6 sys/miscfs/procfs/procfs_subr.c
--- a/sys/miscfs/procfs/procfs_subr.c Thu Sep 26 17:33:18 2019 +0000
+++ b/sys/miscfs/procfs/procfs_subr.c Thu Sep 26 17:34:08 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_subr.c,v 1.113 2019/03/30 23:28:30 christos Exp $ */
+/* $NetBSD: procfs_subr.c,v 1.114 2019/09/26 17:34:08 christos Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.113 2019/03/30 23:28:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.114 2019/09/26 17:34:08 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -317,7 +317,7 @@
int
vfs_getuserstr(struct uio *uio, char *bf, int *buflenp)
{
- int xlen;
+ size_t xlen;
int error;
if (uio->uio_offset != 0)
Home |
Main Index |
Thread Index |
Old Index