Date: Thu, 12 Mar 2015 16:05:53 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r279926 - stable/10/sys/kern Message-ID: <201503121605.t2CG5rFn076485@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Thu Mar 12 16:05:52 2015 New Revision: 279926 URL: https://svnweb.freebsd.org/changeset/base/279926 Log: MFC r272566: Convert -1 from sbuf_bcat() to ENOMEM. Modified: stable/10/sys/kern/kern_descrip.c stable/10/sys/kern/kern_proc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_descrip.c ============================================================================== --- stable/10/sys/kern/kern_descrip.c Thu Mar 12 15:58:07 2015 (r279925) +++ stable/10/sys/kern/kern_descrip.c Thu Mar 12 16:05:52 2015 (r279926) @@ -3399,7 +3399,7 @@ export_fd_to_sb(void *data, int type, in } if (locked) FILEDESC_SUNLOCK(efbuf->fdp); - error = sbuf_bcat(efbuf->sb, kif, kif->kf_structsize); + error = sbuf_bcat(efbuf->sb, kif, kif->kf_structsize) == 0 ? 0 : ENOMEM; if (efbuf->fdp != NULL) FILEDESC_SLOCK(efbuf->fdp); return (error); Modified: stable/10/sys/kern/kern_proc.c ============================================================================== --- stable/10/sys/kern/kern_proc.c Thu Mar 12 15:58:07 2015 (r279925) +++ stable/10/sys/kern/kern_proc.c Thu Mar 12 16:05:52 2015 (r279926) @@ -1203,21 +1203,25 @@ kern_proc_out(struct proc *p, struct sbu #ifdef COMPAT_FREEBSD32 if ((flags & KERN_PROC_MASK32) != 0) { freebsd32_kinfo_proc_out(&ki, &ki32); - error = sbuf_bcat(sb, &ki32, sizeof(ki32)); + if (sbuf_bcat(sb, &ki32, sizeof(ki32)) != 0) + error = ENOMEM; } else #endif - error = sbuf_bcat(sb, &ki, sizeof(ki)); + if (sbuf_bcat(sb, &ki, sizeof(ki)) != 0) + error = ENOMEM; } else { FOREACH_THREAD_IN_PROC(p, td) { fill_kinfo_thread(td, &ki, 1); #ifdef COMPAT_FREEBSD32 if ((flags & KERN_PROC_MASK32) != 0) { freebsd32_kinfo_proc_out(&ki, &ki32); - error = sbuf_bcat(sb, &ki32, sizeof(ki32)); + if (sbuf_bcat(sb, &ki32, sizeof(ki32)) != 0) + error = ENOMEM; } else #endif - error = sbuf_bcat(sb, &ki, sizeof(ki)); - if (error) + if (sbuf_bcat(sb, &ki, sizeof(ki)) != 0) + error = ENOMEM; + if (error != 0) break; } } @@ -1768,7 +1772,8 @@ proc_getauxv(struct thread *td, struct p else #endif size = vsize * sizeof(Elf_Auxinfo); - error = sbuf_bcat(sb, auxv, size); + if (sbuf_bcat(sb, auxv, size) != 0) + error = ENOMEM; free(auxv, M_TEMP); } return (error); @@ -2354,9 +2359,10 @@ kern_proc_vmmap_out(struct proc *p, stru strlen(kve->kve_path) + 1; kve->kve_structsize = roundup(kve->kve_structsize, sizeof(uint64_t)); - error = sbuf_bcat(sb, kve, kve->kve_structsize); + if (sbuf_bcat(sb, kve, kve->kve_structsize) != 0) + error = ENOMEM; vm_map_lock_read(map); - if (error) + if (error != 0) break; if (last_timestamp != map->timestamp) { vm_map_lookup_entry(map, addr - 1, &tmp_entry);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503121605.t2CG5rFn076485>