From: dlg Date: Tue, 13 Jun 2017 06:16:31 +0000 (+0000) Subject: use size_t for the size of things in memory, not int. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7ca29ea323649baba8c5ce0a5eb278d877d9c040;p=openbsd use size_t for the size of things in memory, not int. this tweaks the len argument to sysctl_rdstring, sysctl_struct, and sysctl_rdstruct. there's probably more to fix. ok millert@ --- diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 218cc683e8d..13024bf6ecb 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.326 2017/05/06 18:18:11 bluhm Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.327 2017/06/13 06:16:31 dlg Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -977,7 +977,8 @@ sysctl__string(void *oldp, size_t *oldlenp, void *newp, size_t newlen, int sysctl_rdstring(void *oldp, size_t *oldlenp, void *newp, const char *str) { - int len, error = 0; + size_t len; + int error = 0; len = strlen(str) + 1; if (oldp && *oldlenp < len) @@ -996,7 +997,7 @@ sysctl_rdstring(void *oldp, size_t *oldlenp, void *newp, const char *str) */ int sysctl_struct(void *oldp, size_t *oldlenp, void *newp, size_t newlen, void *sp, - int len) + size_t len) { int error = 0; @@ -1019,7 +1020,7 @@ sysctl_struct(void *oldp, size_t *oldlenp, void *newp, size_t newlen, void *sp, */ int sysctl_rdstruct(void *oldp, size_t *oldlenp, void *newp, const void *sp, - int len) + size_t len) { int error = 0; diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index ca5213b373d..78155712a2e 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.h,v 1.172 2017/02/27 19:16:56 claudio Exp $ */ +/* $OpenBSD: sysctl.h,v 1.173 2017/06/13 06:16:31 dlg Exp $ */ /* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */ /* @@ -932,8 +932,8 @@ int sysctl_string(void *, size_t *, void *, size_t, char *, int); int sysctl_tstring(void *, size_t *, void *, size_t, char *, int); int sysctl__string(void *, size_t *, void *, size_t, char *, int, int); int sysctl_rdstring(void *, size_t *, void *, const char *); -int sysctl_rdstruct(void *, size_t *, void *, const void *, int); -int sysctl_struct(void *, size_t *, void *, size_t, void *, int); +int sysctl_rdstruct(void *, size_t *, void *, const void *, size_t); +int sysctl_struct(void *, size_t *, void *, size_t, void *, size_t); int sysctl_file(int *, u_int, char *, size_t *, struct proc *); int sysctl_doproc(int *, u_int, char *, size_t *); struct rtentry;