From nobody Wed Feb 21 03:19:14 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TfhMR1HNFz5BGMF; Wed, 21 Feb 2024 03:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TfhMR0h5gz4Sv7; Wed, 21 Feb 2024 03:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708485555; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aRAL1WSiBa6h7Do8iAKzaH+91Ep96RyZrSFi/+ETgIE=; b=MtNICdYGgs0ZJdZREPO55GBc4vkeX+YSjf2NY1hcv6G/zjRqCh0ymw44fw2lPj4w0wcSlM 6zrxbKAjPPKTXdqpHqHfRDiEjqbyBiUNrURui78lkIjwjmlo9VHY0XxjxhrPr/BNlM1ehm zi0CtoV/YT8UW8pHKZUsBeWc6aveo/EhEqMEHB/1DpThPYm+0wHLqa+KUT57UqfOcwGOTg 9GhgTBWpkJvidKcqhV2TRhUOQddeNdde1jXQZ4NKhWqTA9oo4YjFOy2696u9AlRF8/BvXs uYI38qz2KrmUUo0ndWrpggXww8EWVPYbMzkqRpNtxKOfx5M+/WLaHsAD/e/hDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708485555; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aRAL1WSiBa6h7Do8iAKzaH+91Ep96RyZrSFi/+ETgIE=; b=Cs9GY0kGweT+nzSmwQcatqVe4lkxTRAF3D+op6SozjtngBxtzH0BLBP8oPUSu037xdJ/ZQ rxYFJZVKmBHq8m13EdfbXKed6kgIPdgjcaZHv0rcxi5UH+2Mg652F1XrXrcV3Pwb+G52jH Obm2PmVx0oT69zWJjQAcXIGBwGlDocG/0sqp/oGTZV2ovv+yQ64BrnjIxq8k/Q9+fgw7cs 5mlkcyD+eS9Il1/AcWuztIQT5bqLB92VE0J5TZIozJ8GXnoIkYe6QNgUvE0fy1StJz/Oi7 N8pM3OJefE/UsaXOp8GRJvnWse2ahjylXrIlrN5EUlh2VROku4wvh+OtQSr3vw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708485555; a=rsa-sha256; cv=none; b=QWTJJcpW3wYAi0wVIOEsuSLAcIvIgwSaONgZdxrGr+iFWvY2zmFF8MigvySBQwGyAG64ZG 2deGysojNt2Z9Alt/f/MrTSh9kiUdTAdtmOmEMc8tERJb0y0SLG92MOo7bw+Z48YNLVOC+ +hbgPFD9oXRmXzpjaBRUNkcnPOz5F+Ij5aNXo3veE2h3MDyAKv0hbsqFF91P7j1vs7VVJU A73fW6SxFYUGwNYFm6tqcziHlneebWFLJH7x4cfMH5wB7EFti6bGbRtlcxuylQRd3jkjO4 KTXlCdSnC5VYE17Des6pVd0TI/ooOmh+jK/b4m4dbbM/lIGX23iYzQKgRSmsMw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TfhMQ6rV2zlsr; Wed, 21 Feb 2024 03:19:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41L3JEnc087263; Wed, 21 Feb 2024 03:19:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41L3JE6L087260; Wed, 21 Feb 2024 03:19:14 GMT (envelope-from git) Date: Wed, 21 Feb 2024 03:19:14 GMT Message-Id: <202402210319.41L3JE6L087260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: cd6e526e268e - main - loader/libofw: Fix disk size truncation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd6e526e268e4fdf1c9a65b9d792e67343f52307 Auto-Submitted: auto-generated The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=cd6e526e268e4fdf1c9a65b9d792e67343f52307 commit cd6e526e268e4fdf1c9a65b9d792e67343f52307 Author: Justin Hibbits AuthorDate: 2024-02-20 22:08:54 +0000 Commit: Justin Hibbits CommitDate: 2024-02-21 03:17:26 +0000 loader/libofw: Fix disk size truncation At present OF_ioctl first multiplies, then casts to 64-bit, meaning at the asm level it truncates the result to 32-bit, then zero-extends it to 64-bit to return. Cast `n` to 64-bit before multiplying, so that the correct result is returned. --- stand/libofw/ofw_disk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/libofw/ofw_disk.c b/stand/libofw/ofw_disk.c index e9002ca23fe9..d30454b70b74 100644 --- a/stand/libofw/ofw_disk.c +++ b/stand/libofw/ofw_disk.c @@ -174,7 +174,7 @@ ofwd_ioctl(struct open_file *f, u_long cmd, void *data) case DIOCGMEDIASIZE: block_size = OF_block_size(dev->d_handle); n = OF_blocks(dev->d_handle); - *(uint64_t *)data = (uint64_t)(n * block_size); + *(uint64_t *)data = ((uint64_t)n * block_size); break; default: return (ENOTTY);