Author: mav
Date: Thu Aug  2 20:44:07 2018
New Revision: 337179
URL: https://svnweb.freebsd.org/changeset/base/337179

Log:
  9523 Large alloc in zdb can cause trouble
  
  16MB alloc in zdb_embedded_block() can cause cores in certain situations
  (clang, gcc55).
  
  OsX commit: 
https://github.com/openzfsonosx/zfs/commit/ced236a5da6e72ea7bf6d2919fe14e17cffe10f1
  FreeBSD commit: https://svnweb.freebsd.org/base?view=revision&revision=326150
  illumos/illumos-gate@03a4c2f4bfaca30115963b76445279b36468a614
  
  Reviewed by: Igor Kozhukhov <i...@dilos.org>
  Reviewed by: Andriy Gapon <a...@freebsd.org>
  Reviewed by: Matthew Ahrens <mahr...@delphix.com>
  Approved by: Dan McDonald <dan...@joyent.com>
  Author:     Jorgen Lundman <lund...@lundman.net>
  
  This is an update for r326150 (by avg), where this change comes from.

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zdb/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Aug  2 20:37:53 2018        
(r337178)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Aug  2 20:44:07 2018        
(r337179)
@@ -4950,19 +4950,18 @@ zdb_embedded_block(char *thing)
            words + 8, words + 9, words + 10, words + 11,
            words + 12, words + 13, words + 14, words + 15);
        if (err != 16) {
-               (void) printf("invalid input format\n");
+               (void) fprintf(stderr, "invalid input format\n");
                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);
+               (void) fprintf(stderr, "out of memory\n");
                exit(1);
        }
        err = decode_embedded_bp(&bp, buf, BPE_GET_LSIZE(&bp));
        if (err != 0) {
-               (void) printf("decode failed: %u\n", err);
+               (void) fprintf(stderr, "decode failed: %u\n", err);
                free(buf);
                exit(1);
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to