Module Name:    src
Committed By:   jakllsch
Date:           Fri Sep 14 21:37:03 UTC 2018

Modified Files:
        src/sys/stand/efiboot: efiblock.c

Log Message:
MI efiboot: avoid LBA overflow in efi_block_find_partitions_disklabel()


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/stand/efiboot/efiblock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/stand/efiboot/efiblock.c
diff -u src/sys/stand/efiboot/efiblock.c:1.2 src/sys/stand/efiboot/efiblock.c:1.3
--- src/sys/stand/efiboot/efiblock.c:1.2	Mon Aug 27 09:51:32 2018
+++ src/sys/stand/efiboot/efiblock.c	Fri Sep 14 21:37:03 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: efiblock.c,v 1.2 2018/08/27 09:51:32 jmcneill Exp $ */
+/* $NetBSD: efiblock.c,v 1.3 2018/09/14 21:37:03 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <[email protected]>
@@ -115,7 +115,7 @@ efi_block_find_partitions_disklabel(stru
 	if (!buf)
 		return ENOMEM;
 
-	lba = ((start + LABELSECTOR) * DEV_BSIZE) / bdev->bio->Media->BlockSize;
+	lba = (((EFI_LBA)start + LABELSECTOR) * DEV_BSIZE) / bdev->bio->Media->BlockSize;
 	status = uefi_call_wrapper(bdev->bio->ReadBlocks, 5, bdev->bio, bdev->media_id, lba, sz, buf);
 	if (EFI_ERROR(status) || getdisklabel(buf, &d) != NULL) {
 		FreePool(buf);

Reply via email to