diff --git a/sys/arch/i386/i386/identcpu.c b/sys/arch/i386/i386/identcpu.c index f44c53f25a02..8b012c66497c 100644 --- a/sys/arch/i386/i386/identcpu.c +++ b/sys/arch/i386/i386/identcpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: identcpu.c,v 1.32 2006/05/29 17:35:41 rpaulo Exp $ */ +/* $NetBSD: identcpu.c,v 1.33 2006/06/20 03:23:09 christos Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.32 2006/05/29 17:35:41 rpaulo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.33 2006/06/20 03:23:09 christos Exp $"); #include "opt_cputype.h" #include "opt_enhanced_speedstep.h" @@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.32 2006/05/29 17:35:41 rpaulo Exp $") #include #include +#include #include @@ -1125,9 +1126,10 @@ identifycpu(struct cpu_info *ci) const struct cpu_cpuid_nameclass *cpup = NULL; const struct cpu_cpuid_family *cpufam; char *cpuname = ci->ci_dev->dv_xname; - char buf[1024]; + char *buf; const char *feature_str[3]; + buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); if (ci->ci_cpuid_level == -1) { #ifdef DIAGNOSTIC if (cpu < 0 || cpu >= @@ -1272,33 +1274,35 @@ identifycpu(struct cpu_info *ci) if (ci->ci_feature_flags) { if ((ci->ci_feature_flags & CPUID_MASK1) != 0) { bitmask_snprintf(ci->ci_feature_flags, - feature_str[0], buf, sizeof(buf)); + feature_str[0], buf, MAXPATHLEN); aprint_verbose("%s: features %s\n", cpuname, buf); } if ((ci->ci_feature_flags & CPUID_MASK2) != 0) { bitmask_snprintf(ci->ci_feature_flags, - feature_str[1], buf, sizeof(buf)); + feature_str[1], buf, MAXPATHLEN); aprint_verbose("%s: features %s\n", cpuname, buf); } if ((ci->ci_feature_flags & CPUID_MASK3) != 0) { bitmask_snprintf(ci->ci_feature_flags, - feature_str[2], buf, sizeof(buf)); + feature_str[2], buf, MAXPATHLEN); aprint_verbose("%s: features %s\n", cpuname, buf); } } if (ci->ci_feature2_flags) { bitmask_snprintf(ci->ci_feature2_flags, - CPUID2_FLAGS, buf, sizeof(buf)); + CPUID2_FLAGS, buf, MAXPATHLEN); aprint_verbose("%s: features2 %s\n", cpuname, buf); } if (ci->ci_feature3_flags) { bitmask_snprintf(ci->ci_feature3_flags, - CPUID_FLAGS4, buf, sizeof(buf)); + CPUID_FLAGS4, buf, MAXPATHLEN); aprint_verbose("%s: features3 %s\n", cpuname, buf); } + free(buf, M_TEMP); + if (*cpu_brand_string != '\0') aprint_normal("%s: \"%s\"\n", cpuname, cpu_brand_string); diff --git a/sys/fs/ptyfs/ptyfs_vfsops.c b/sys/fs/ptyfs/ptyfs_vfsops.c index 3754b623ee0f..5989e5036a52 100644 --- a/sys/fs/ptyfs/ptyfs_vfsops.c +++ b/sys/fs/ptyfs/ptyfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ptyfs_vfsops.c,v 1.15 2006/05/14 21:31:52 elad Exp $ */ +/* $NetBSD: ptyfs_vfsops.c,v 1.16 2006/06/20 03:22:12 christos Exp $ */ /* * Copyright (c) 1992, 1993, 1995 @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.15 2006/05/14 21:31:52 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.16 2006/06/20 03:22:12 christos Exp $"); #include #include @@ -97,27 +97,31 @@ struct ptm_pty ptm_ptyfspty = { static const char * ptyfs__getpath(struct lwp *l, const struct mount *mp) { +#define MAXBUF (sizeof(mp->mnt_stat.f_mntonname) + 32) struct cwdinfo *cwdi = l->l_proc->p_cwdi; - char buf[sizeof(mp->mnt_stat.f_mntonname) + 32]; + char *buf, *rv; size_t len; char *bp; int error; + rv = mp->mnt_stat.f_mntonname; if (cwdi->cwdi_rdir == NULL) - return mp->mnt_stat.f_mntonname; + return rv; - bp = buf + sizeof(buf); + buf = malloc(MAXBUF, M_TEMP, M_WAITOK); + bp = buf + MAXBUF; *--bp = '\0'; error = getcwd_common(cwdi->cwdi_rdir, rootvnode, &bp, - buf, sizeof(buf) / 2, 0, l); + buf, MAXBUF / 2, 0, l); if (error) /* XXX */ - return mp->mnt_stat.f_mntonname; + goto out; len = strlen(bp); - if (len >= sizeof(mp->mnt_stat.f_mntonname)) /* XXX */ - return mp->mnt_stat.f_mntonname; - else - return &mp->mnt_stat.f_mntonname[len]; + if (len < sizeof(mp->mnt_stat.f_mntonname)) /* XXX */ + rv += len; +out: + free(buf, M_TEMP); + return rv; } static int diff --git a/sys/fs/udf/udf_subr.c b/sys/fs/udf/udf_subr.c index b465fa182a22..44169003553c 100644 --- a/sys/fs/udf/udf_subr.c +++ b/sys/fs/udf/udf_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: udf_subr.c,v 1.9 2006/06/12 00:18:06 christos Exp $ */ +/* $NetBSD: udf_subr.c,v 1.10 2006/06/20 03:22:12 christos Exp $ */ /* * Copyright (c) 2006 Reinoud Zandijk @@ -36,7 +36,7 @@ #include #ifndef lint -__RCSID("$NetBSD: udf_subr.c,v 1.9 2006/06/12 00:18:06 christos Exp $"); +__RCSID("$NetBSD: udf_subr.c,v 1.10 2006/06/20 03:22:12 christos Exp $"); #endif /* not lint */ @@ -2600,7 +2600,7 @@ void udf_read_filebuf(struct udf_node *node, struct buf *buf) { struct buf *nestbuf; - uint64_t mapping[FILEBUFSECT]; + uint64_t *mapping; uint64_t run_start; uint32_t sector_size; uint32_t buf_offset, sector, rbuflen, rblk; @@ -2627,6 +2627,8 @@ udf_read_filebuf(struct udf_node *node, struct buf *buf) return; } + mapping = malloc(sizeof(*mapping) * FILEBUFSECT, M_TEMP, M_WAITOK); + error = 0; DPRINTF(READ, ("\ttranslate %d-%d\n", from, sectors)); error = udf_translate_file_extent(node, from, sectors, mapping); @@ -2634,7 +2636,7 @@ udf_read_filebuf(struct udf_node *node, struct buf *buf) buf->b_error = error; buf->b_flags |= B_ERROR; biodone(buf); - return; + goto out; } DPRINTF(READ, ("\ttranslate extent went OK\n")); @@ -2646,7 +2648,7 @@ udf_read_filebuf(struct udf_node *node, struct buf *buf) buf->b_flags |= B_ERROR; } biodone(buf); - return; + goto out; } DPRINTF(READ, ("\tnot intern\n")); @@ -2698,7 +2700,10 @@ udf_read_filebuf(struct udf_node *node, struct buf *buf) VOP_STRATEGY(node->ump->devvp, nestbuf); } } +out: DPRINTF(READ, ("\tend of read_filebuf\n")); + free(mapping, M_TEMP); + return; } #undef FILEBUFSECT