Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/stand/efiboot Fix buffer size for alignment adjusted blo...



details:   https://anonhg.NetBSD.org/src/rev/46f0e0af5677
branches:  trunk
changeset: 379867:46f0e0af5677
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Jun 23 20:55:50 2021 +0000

description:
Fix buffer size for alignment adjusted block I/O reads.

diffstat:

 sys/stand/efiboot/efiblock.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 46337c5f172f -r 46f0e0af5677 sys/stand/efiboot/efiblock.c
--- a/sys/stand/efiboot/efiblock.c      Wed Jun 23 20:20:44 2021 +0000
+++ b/sys/stand/efiboot/efiblock.c      Wed Jun 23 20:55:50 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efiblock.c,v 1.15 2021/06/22 21:56:51 jmcneill Exp $ */
+/* $NetBSD: efiblock.c,v 1.16 2021/06/23 20:55:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -133,7 +133,9 @@ efi_block_do_read_blockio(struct efi_blo
        blkbuf_offset = off % bdev->bio->Media->BlockSize;
        blkbuf_size = (lba_end - lba_start) * bdev->bio->Media->BlockSize;
        if (bdev->bio->Media->IoAlign > 1) {
-               blkbuf_size += bdev->bio->Media->IoAlign - 1;
+               blkbuf_size = (blkbuf_size + bdev->bio-Media->IoAlign - 1) /
+                   bdev->bio->Media->IoAlign *
+                   bdev->bio->Media->IoAlign;
        }
 
        blkbuf = AllocatePool(blkbuf_size);



Home | Main Index | Thread Index | Old Index