Index: stand/efi/libefi/devicename.c =================================================================== --- stand/efi/libefi/devicename.c +++ stand/efi/libefi/devicename.c @@ -115,6 +115,7 @@ if (idev == NULL) return (ENOMEM); + idev->d_size = sizeof(struct disk_devdesc); err = disk_parsedev((struct disk_devdesc *)idev, np, path); if (err != 0) goto fail; @@ -126,6 +127,7 @@ if (idev == NULL) return (ENOMEM); + idev->d_size = sizeof(struct zfs_devdesc); err = zfs_parsedev((struct zfs_devdesc*)idev, np, path); if (err != 0) goto fail; @@ -136,6 +138,7 @@ if (idev == NULL) return (ENOMEM); + idev->d_size = sizeof(struct devdesc); unit = 0; cp = (char *)np; Index: stand/i386/libi386/devicename.c =================================================================== --- stand/i386/libi386/devicename.c +++ stand/i386/libi386/devicename.c @@ -117,6 +117,7 @@ if (idev == NULL) return (ENOMEM); + idev->dd.d_size = sizeof(struct i386_devdesc); err = disk_parsedev((struct disk_devdesc *)idev, np, path); if (err != 0) goto fail; @@ -126,7 +127,7 @@ idev = malloc(sizeof (struct zfs_devdesc)); if (idev == NULL) return (ENOMEM); - + idev->dd.d_size = sizeof(struct zfs_devdesc); err = zfs_parsedev((struct zfs_devdesc *)idev, np, path); if (err != 0) goto fail; @@ -137,6 +138,7 @@ if (idev == NULL) return (ENOMEM); + idev->dd.d_size = sizeof(struct devdesc); unit = 0; cp = (char *)np; Index: stand/i386/zfsboot/zfsboot.c =================================================================== --- stand/i386/zfsboot/zfsboot.c +++ stand/i386/zfsboot/zfsboot.c @@ -714,6 +714,7 @@ if (pool_guid != 0 && bdev == NULL) { bdev = malloc(sizeof (struct i386_devdesc)); bzero(bdev, sizeof (struct i386_devdesc)); + bdev->dd.d_size = sizeof(*bdev); bdev->dd.d_dev = &zfs_dev; bdev->d_kind.zfs.pool_guid = pool_guid; } Index: stand/libofw/devicename.c =================================================================== --- stand/libofw/devicename.c +++ stand/libofw/devicename.c @@ -112,6 +112,7 @@ printf("ofw_parsedev: malloc failed\n"); return ENOMEM; } + idev->dd.d_size = sizeof(*idev); strcpy(idev->d_path, name); idev->dd.d_dev = dv; if (dv->dv_type == DEVT_ZFS) { Index: stand/libsa/stand.h =================================================================== --- stand/libsa/stand.h +++ stand/libsa/stand.h @@ -174,6 +174,7 @@ */ struct devdesc { struct devsw *d_dev; + size_t d_size; int d_unit; void *d_opendata; }; Index: stand/libsa/zfs/zfs.c =================================================================== --- stand/libsa/zfs/zfs.c +++ stand/libsa/zfs/zfs.c @@ -381,7 +381,7 @@ zfsdev = malloc(sizeof(*zfsdev)); if (zfsdev == NULL) return (errno); - + zfsdev->dd.d_size = sizeof(*zfsdev); rv = zfs_parsedev(zfsdev, dev + 3, NULL); if (rv != 0) { free(zfsdev); Index: stand/uboot/devicename.c =================================================================== --- stand/uboot/devicename.c +++ stand/uboot/devicename.c @@ -106,6 +106,9 @@ if (dv == NULL) return(ENOENT); idev = malloc(sizeof(struct uboot_devdesc)); + if (idev == NULL) + return(ENOMEM); + idev->dd.d_size = sizeof(*idev); err = 0; np = (devspec + strlen(dv->dv_name)); Index: stand/userboot/userboot/devicename.c =================================================================== --- stand/userboot/userboot/devicename.c +++ stand/userboot/userboot/devicename.c @@ -111,6 +111,9 @@ if (dv == NULL) return (ENOENT); idev = malloc(sizeof(struct disk_devdesc)); + if (idev == NULL) + return (ENOMEM); + idev->dd.d_size = sizeof(*idev); err = 0; np = (devspec + strlen(dv->dv_name));