Date: Thu, 24 Oct 2019 03:06:37 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353985 - stable/12/stand/libsa/zfs Message-ID: <201910240306.x9O36bUs006922@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Thu Oct 24 03:06:37 2019 New Revision: 353985 URL: https://svnweb.freebsd.org/changeset/base/353985 Log: MFC r348352, r348354 r348352: loader: zfs_alloc and zfs_free should use panic The zfs alloc and free code print out the error and get stuck in infinite loop; use panic() instead. r348354: loader: malloc+memset is calloc in spa_create Replace malloc + memset pair with calloc. Modified: stable/12/stand/libsa/zfs/zfsimpl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/zfs/zfsimpl.c ============================================================================== --- stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:04:36 2019 (r353984) +++ stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:06:37 2019 (r353985) @@ -174,8 +174,7 @@ zfs_alloc(size_t size) char *ptr; if (zfs_temp_ptr + size > zfs_temp_end) { - printf("ZFS: out of temporary buffer space\n"); - for (;;) ; + panic("ZFS: out of temporary buffer space"); } ptr = zfs_temp_ptr; zfs_temp_ptr += size; @@ -189,8 +188,7 @@ zfs_free(void *ptr, size_t size) zfs_temp_ptr -= size; if (zfs_temp_ptr != ptr) { - printf("ZFS: zfs_alloc()/zfs_free() mismatch\n"); - for (;;) ; + panic("ZFS: zfs_alloc()/zfs_free() mismatch"); } } @@ -1341,9 +1339,8 @@ spa_create(uint64_t guid, const char *name) { spa_t *spa; - if ((spa = malloc(sizeof(spa_t))) == NULL) + if ((spa = calloc(1, sizeof(spa_t))) == NULL) return (NULL); - memset(spa, 0, sizeof(spa_t)); if ((spa->spa_name = strdup(name)) == NULL) { free(spa); return (NULL);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910240306.x9O36bUs006922>