aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/lib/libefi/rdwr_efi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/openzfs/lib/libefi/rdwr_efi.c')
-rw-r--r--sys/contrib/openzfs/lib/libefi/rdwr_efi.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/contrib/openzfs/lib/libefi/rdwr_efi.c b/sys/contrib/openzfs/lib/libefi/rdwr_efi.c
index 30fddc3db8a8..0a93fd1338f6 100644
--- a/sys/contrib/openzfs/lib/libefi/rdwr_efi.c
+++ b/sys/contrib/openzfs/lib/libefi/rdwr_efi.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: CDDL-1.0
/*
* CDDL HEADER START
*
@@ -6,7 +7,7 @@
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
+ * or https://opensource.org/licenses/CDDL-1.0.
* See the License for the specific language governing permissions
* and limitations under the License.
*
@@ -423,7 +424,6 @@ efi_alloc_and_read(int fd, struct dk_gpt **vtoc)
void *tmp;
length = (int) sizeof (struct dk_gpt) +
(int) sizeof (struct dk_part) * (vptr->efi_nparts - 1);
- nparts = vptr->efi_nparts;
if ((tmp = realloc(vptr, length)) == NULL) {
/* cppcheck-suppress doubleFree */
free(vptr);
@@ -565,10 +565,9 @@ int
efi_rescan(int fd)
{
int retry = 10;
- int error;
/* Notify the kernel a devices partition table has been updated */
- while ((error = ioctl(fd, BLKRRPART)) != 0) {
+ while (ioctl(fd, BLKRRPART) != 0) {
if ((--retry == 0) || (errno != EBUSY)) {
(void) fprintf(stderr, "the kernel failed to rescan "
"the partition table: %d\n", errno);
@@ -1177,8 +1176,8 @@ efi_use_whole_disk(int fd)
* (for performance reasons). The alignment should match the
* alignment used by the "zpool_label_disk" function.
*/
- limit = P2ALIGN(efi_label->efi_last_lba - nblocks - EFI_MIN_RESV_SIZE,
- PARTITION_END_ALIGNMENT);
+ limit = P2ALIGN_TYPED(efi_label->efi_last_lba - nblocks -
+ EFI_MIN_RESV_SIZE, PARTITION_END_ALIGNMENT, diskaddr_t);
if (data_start + data_size != limit || resv_start != limit)
sync_needed = B_TRUE;
@@ -1364,7 +1363,7 @@ efi_write(int fd, struct dk_gpt *vtoc)
if (NBLOCKS(vtoc->efi_nparts, vtoc->efi_lbasize) < 34) {
dk_ioc.dki_length = EFI_MIN_ARRAY_SIZE + vtoc->efi_lbasize;
} else {
- dk_ioc.dki_length = NBLOCKS(vtoc->efi_nparts,
+ dk_ioc.dki_length = (len_t)NBLOCKS(vtoc->efi_nparts,
vtoc->efi_lbasize) *
vtoc->efi_lbasize;
}