From 087266ec33c76fc8d54ac5a19efacf2f4a4ca076 Mon Sep 17 00:00:00 2001 From: "deraadt@openbsd.org" Date: Tue, 20 Jan 2015 23:14:00 +0000 Subject: upstream commit Reduce use of and transition to throughout. ok djm markus --- monitor_mm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'monitor_mm.c') diff --git a/monitor_mm.c b/monitor_mm.c index 0ba0658a1..f224fb67e 100644 --- a/monitor_mm.c +++ b/monitor_mm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor_mm.c,v 1.19 2014/01/04 17:50:55 tedu Exp $ */ +/* $OpenBSD: monitor_mm.c,v 1.20 2015/01/20 23:14:00 deraadt Exp $ */ /* * Copyright 2002 Niels Provos * All rights reserved. @@ -30,7 +30,6 @@ #ifdef HAVE_SYS_MMAN_H #include #endif -#include #include "openbsd-compat/sys-tree.h" #include @@ -38,6 +37,7 @@ #include #include #include +#include #include "xmalloc.h" #include "ssh.h" -- cgit v1.2.3 From fd36834871d06a03e1ff8d69e41992efa1bbf85f Mon Sep 17 00:00:00 2001 From: "millert@openbsd.org" Date: Fri, 6 Feb 2015 23:21:59 +0000 Subject: upstream commit SIZE_MAX is standard, we should be using it in preference to the obsolete SIZE_T_MAX. OK miod@ beck@ --- channels.c | 6 +++--- monitor.c | 6 +++--- monitor_mm.c | 6 +++--- xmalloc.c | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'monitor_mm.c') diff --git a/channels.c b/channels.c index 2fedaf89d..86c454ab5 100644 --- a/channels.c +++ b/channels.c @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.340 2015/01/20 23:14:00 deraadt Exp $ */ +/* $OpenBSD: channels.c,v 1.341 2015/02/06 23:21:59 millert Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -57,12 +57,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include "openbsd-compat/sys-queue.h" @@ -2184,7 +2184,7 @@ channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp, nfdset = howmany(n+1, NFDBITS); /* Explicitly test here, because xrealloc isn't always called */ - if (nfdset && SIZE_T_MAX / nfdset < sizeof(fd_mask)) + if (nfdset && SIZE_MAX / nfdset < sizeof(fd_mask)) fatal("channel_prepare_select: max_fd (%d) is too large", n); sz = nfdset * sizeof(fd_mask); diff --git a/monitor.c b/monitor.c index 90db9800b..689586c0f 100644 --- a/monitor.c +++ b/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.141 2015/01/20 23:14:00 deraadt Exp $ */ +/* $OpenBSD: monitor.c,v 1.142 2015/02/06 23:21:59 millert Exp $ */ /* * Copyright 2002 Niels Provos * Copyright 2002 Markus Friedl @@ -39,9 +39,9 @@ #endif #include #include +#include #include #include -#include #include #include #include @@ -488,7 +488,7 @@ mm_zalloc(struct mm_master *mm, u_int ncount, u_int size) size_t len = (size_t) size * ncount; void *address; - if (len == 0 || ncount > SIZE_T_MAX / size) + if (len == 0 || ncount > SIZE_MAX / size) fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size); address = mm_malloc(mm, len); diff --git a/monitor_mm.c b/monitor_mm.c index f224fb67e..50731527c 100644 --- a/monitor_mm.c +++ b/monitor_mm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor_mm.c,v 1.20 2015/01/20 23:14:00 deraadt Exp $ */ +/* $OpenBSD: monitor_mm.c,v 1.21 2015/02/06 23:21:59 millert Exp $ */ /* * Copyright 2002 Niels Provos * All rights reserved. @@ -35,9 +35,9 @@ #include #include #include +#include #include #include -#include #include "xmalloc.h" #include "ssh.h" @@ -176,7 +176,7 @@ mm_malloc(struct mm_master *mm, size_t size) if (size == 0) fatal("mm_malloc: try to allocate 0 space"); - if (size > SIZE_T_MAX - MM_MINSIZE + 1) + if (size > SIZE_MAX - MM_MINSIZE + 1) fatal("mm_malloc: size too big"); size = ((size + (MM_MINSIZE - 1)) / MM_MINSIZE) * MM_MINSIZE; diff --git a/xmalloc.c b/xmalloc.c index 0a9f282ae..fe266cc46 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xmalloc.c,v 1.30 2015/01/16 06:40:12 deraadt Exp $ */ +/* $OpenBSD: xmalloc.c,v 1.31 2015/02/06 23:21:59 millert Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -16,10 +16,10 @@ #include "includes.h" #include +#include #include #include #include -#include #include "xmalloc.h" #include "log.h" @@ -44,8 +44,8 @@ xcalloc(size_t nmemb, size_t size) if (size == 0 || nmemb == 0) fatal("xcalloc: zero size"); - if (SIZE_T_MAX / nmemb < size) - fatal("xcalloc: nmemb * size > SIZE_T_MAX"); + if (SIZE_MAX / nmemb < size) + fatal("xcalloc: nmemb * size > SIZE_MAX"); ptr = calloc(nmemb, size); if (ptr == NULL) fatal("xcalloc: out of memory (allocating %zu bytes)", @@ -61,8 +61,8 @@ xrealloc(void *ptr, size_t nmemb, size_t size) if (new_size == 0) fatal("xrealloc: zero size"); - if (SIZE_T_MAX / nmemb < size) - fatal("xrealloc: nmemb * size > SIZE_T_MAX"); + if (SIZE_MAX / nmemb < size) + fatal("xrealloc: nmemb * size > SIZE_MAX"); if (ptr == NULL) new_ptr = malloc(new_size); else -- cgit v1.2.3 From 9af21979c00652029e160295e988dea40758ece2 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 24 Feb 2015 09:04:32 +1100 Subject: don't include stdint.h unless HAVE_STDINT_H set --- monitor.c | 2 ++ monitor_mm.c | 2 ++ xmalloc.c | 2 ++ 3 files changed, 6 insertions(+) (limited to 'monitor_mm.c') diff --git a/monitor.c b/monitor.c index 4f9c9fed6..bab6ce87e 100644 --- a/monitor.c +++ b/monitor.c @@ -39,7 +39,9 @@ #endif #include #include +#ifdef HAVE_STDINT_H #include +#endif #include #include #include diff --git a/monitor_mm.c b/monitor_mm.c index 50731527c..aa47b2ed5 100644 --- a/monitor_mm.c +++ b/monitor_mm.c @@ -35,7 +35,9 @@ #include #include #include +#ifdef HAVE_STDINT_H #include +#endif #include #include diff --git a/xmalloc.c b/xmalloc.c index fe266cc46..cd59dc2e5 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -16,7 +16,9 @@ #include "includes.h" #include +#ifdef HAVE_STDINT_H #include +#endif #include #include #include -- cgit v1.2.3