git: 06d16b8e9ba9 - stable/12 - loader: geli_dev_ioctl does return huge mediasize

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 08 Oct 2021 01:16:41 UTC
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=06d16b8e9ba9f1ad0540c54402485081e0dbf93e

commit 06d16b8e9ba9f1ad0540c54402485081e0dbf93e
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2020-07-07 12:24:40 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 01:15:59 +0000

    loader: geli_dev_ioctl does return huge mediasize
    
    The DIOCGMEDIASIZE is calculated md->md_sectorsize * md->md_provsize, and
    for boot disk, the md_sectorsize is 4k. However, the md_provsize is already
    in units of bytes.
    
    (cherry picked from commit 0d1a62068123df267e20530c86d2fc7a4e1aaa2e)
---
 stand/libsa/geli/gelidev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stand/libsa/geli/gelidev.c b/stand/libsa/geli/gelidev.c
index 8c1359c0b49a..751255636112 100644
--- a/stand/libsa/geli/gelidev.c
+++ b/stand/libsa/geli/gelidev.c
@@ -219,7 +219,7 @@ geli_dev_ioctl(struct open_file *f, u_long cmd, void *data)
 		*(u_int *)data = md->md_sectorsize;
 		break;
 	case DIOCGMEDIASIZE:
-		*(uint64_t *)data = md->md_sectorsize * md->md_provsize;
+		*(uint64_t *)data = md->md_provsize;
 		break;
 	default:
 		return (ENOTTY);