From owner-svn-src-stable-11@freebsd.org Mon Dec 4 16:47:20 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9D18E5D56D; Mon, 4 Dec 2017 16:47:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 961026F5C2; Mon, 4 Dec 2017 16:47:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB4GlJam091554; Mon, 4 Dec 2017 16:47:19 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB4GlJaf091553; Mon, 4 Dec 2017 16:47:19 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201712041647.vB4GlJaf091553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 4 Dec 2017 16:47:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326536 - stable/11/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zdb X-SVN-Commit-Revision: 326536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Dec 2017 16:47:20 -0000 Author: avg Date: Mon Dec 4 16:47:19 2017 New Revision: 326536 URL: https://svnweb.freebsd.org/changeset/base/326536 Log: MFC r326150: zdb: use a heap allocation instead of a huge array on stack Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Dec 4 16:38:20 2017 (r326535) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Dec 4 16:47:19 2017 (r326536) @@ -3724,7 +3724,7 @@ zdb_embedded_block(char *thing) { blkptr_t bp = { 0 }; unsigned long long *words = (void *)&bp; - char buf[SPA_MAXBLOCKSIZE]; + char *buf; int err; err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:" @@ -3738,12 +3738,20 @@ zdb_embedded_block(char *thing) exit(1); } ASSERT3U(BPE_GET_LSIZE(&bp), <=, SPA_MAXBLOCKSIZE); + buf = malloc(SPA_MAXBLOCKSIZE); + if (buf == NULL) { + (void) fprintf(stderr, "%s: failed to allocate %llu bytes\n", + __func__, SPA_MAXBLOCKSIZE); + exit(1); + } err = decode_embedded_bp(&bp, buf, BPE_GET_LSIZE(&bp)); if (err != 0) { (void) printf("decode failed: %u\n", err); + free(buf); exit(1); } zdb_dump_block_raw(buf, BPE_GET_LSIZE(&bp), 0); + free(buf); } static boolean_t