Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys Protect local variables in MALLOC/FREE to avoid shad...
details: https://anonhg.NetBSD.org/src/rev/f5ed6cfa69fe
branches: trunk
changeset: 533608:f5ed6cfa69fe
user: gmcgarry <gmcgarry%NetBSD.org@localhost>
date: Fri Jul 05 06:54:45 2002 +0000
description:
Protect local variables in MALLOC/FREE to avoid shadowing
arguments. Problem reported by David Laight: david%l8s.co.uk@localhost.
diffstat:
sys/sys/malloc.h | 34 +++++++++++++++++-----------------
1 files changed, 17 insertions(+), 17 deletions(-)
diffs (60 lines):
diff -r 2dded14eb0cc -r f5ed6cfa69fe sys/sys/malloc.h
--- a/sys/sys/malloc.h Fri Jul 05 04:03:15 2002 +0000
+++ b/sys/sys/malloc.h Fri Jul 05 06:54:45 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: malloc.h,v 1.77 2002/01/12 00:00:39 nathanw Exp $ */
+/* $NetBSD: malloc.h,v 1.78 2002/07/05 06:54:45 gmcgarry Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -425,34 +425,34 @@
#else /* do not collect statistics */
#define MALLOC(space, cast, size, type, flags) \
do { \
- register struct kmembuckets *kbp = &bucket[BUCKETINDX((size))]; \
- long s = splvm(); \
- if (kbp->kb_next == NULL) { \
+ register struct kmembuckets *__kbp = &bucket[BUCKETINDX((size))]; \
+ long __s = splvm(); \
+ if (__kbp->kb_next == NULL) { \
(space) = (cast)malloc((u_long)(size), (type), (flags)); \
} else { \
- (space) = (cast)kbp->kb_next; \
- kbp->kb_next = *(caddr_t *)(space); \
+ (space) = (cast)__kbp->kb_next; \
+ __kbp->kb_next = *(caddr_t *)(space); \
} \
- splx(s); \
+ splx(__s); \
} while (/* CONSTCOND */ 0)
#define FREE(addr, type) \
do { \
- register struct kmembuckets *kbp; \
- register struct kmemusage *kup = btokup((addr)); \
- long s = splvm(); \
- if (1 << kup->ku_indx > MAXALLOCSAVE) { \
+ register struct kmembuckets *__kbp; \
+ register struct kmemusage *__kup = btokup((addr)); \
+ long __s = splvm(); \
+ if (1 << __kup->ku_indx > MAXALLOCSAVE) { \
free((caddr_t)(addr), (type)); \
} else { \
- kbp = &bucket[kup->ku_indx]; \
- if (kbp->kb_next == NULL) \
- kbp->kb_next = (caddr_t)(addr); \
+ __kbp = &bucket[__kup->ku_indx]; \
+ if (__kbp->kb_next == NULL) \
+ __kbp->kb_next = (caddr_t)(addr); \
else \
- *(caddr_t *)(kbp->kb_last) = (caddr_t)(addr); \
+ *(caddr_t *)(__kbp->kb_last) = (caddr_t)(addr); \
*(caddr_t *)(addr) = NULL; \
- kbp->kb_last = (caddr_t)(addr); \
+ __kbp->kb_last = (caddr_t)(addr); \
} \
- splx(s); \
+ splx(__s); \
} while(/* CONSTCOND */ 0)
#endif /* do not collect statistics */
Home |
Main Index |
Thread Index |
Old Index