From nobody Tue Apr 16 20:13:02 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 4VJwFq0K5Bz5H0bJ; Tue, 16 Apr 2024 20:13:03 +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 4VJwFp5QLJz4tMP; Tue, 16 Apr 2024 20:13:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713298382; 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=xCNIMp/Hsd2Ylz9xiW5XygLWj10rufr+1rZ1bYCVrAk=; b=ZxH4E7UkSKmMxYkP1TIuRJ+/Yv/QkG7H5v4obhk2blq7bZNxzkur4xOrzZcbyTA78h+hWV s4YWqFBoc1jk0EWBCBX5vPwsEMMwIbDtuGwY3sx2gShSib5CBZ08rGCvwqIHELwkV9jDpc vl1x8uTx1yhJyWhmr8iPoF37r3HHiJ3+iO+pMH9/3YL7UVZE/4Wyx+RbNV6/viJ/em8BOU J4I0cQ1d2Lpmj1AakCAqjyTjd4S4mg/gEkJZBsIJwU0cuaBFQkwjbaifatH2OIYQtYEr5s yYfWoD8cZy1OIs1c5bH+2u7EKnius1ejF/WbNS11Qxef6mwdl0RlVN+IQquuMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713298382; a=rsa-sha256; cv=none; b=MG3rUT4rOS71cjwRRbK+PiCu8oZCVNpWtVT6kZJFf6/RZc6+H1vOCQCYZ4rfqxxfgeYxmR JaM1ZgWLDv+HH0/APhkLM2Ey+95UkLlqE2FzxxxYoHKIIEdz/3/833cWN9ofxk9svk4ROb ZMB+rwMLELHDgrg/0s9J3HsN23Cft831vbQHCmKKlVAB5od+9a1P1uKH0IQC4xlZK1GvXP zFRX2xKXNYQuStqqJlO5P6rrs3EddWW7zkxWrg+B5QnxCsJmExzidOd2Pqk8PRw4SaxbmL BNt09/o+2BI/oCBjiruplZxMk9CsD1KErxcPbcRrpDJV0cHUkRQiKppn9bxclQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713298382; 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=xCNIMp/Hsd2Ylz9xiW5XygLWj10rufr+1rZ1bYCVrAk=; b=PvSnjdeGi5Lf8S5MYHwC4YjjWUfwun8TTCNGhKnzoNmAEmGNCA1DsculLHWWDFtQnmEp+8 hFUl5mguwUQHxtkVRak3tD1cWo+gTpHypO35Ncma9RGWD4pk2aje4Hj+AsWkRRyg6lvT9M xmoTTUO38Logik8zYXF0kvWrABQaLzueJLvYj1d42ZrP65LGh3I+P8HKAPb5Btz6UjKg4y mZR4y88U6SEhgyB9Yb9rqsqOCbbyr0imqFXpWDeiqf8iL6D+8Vv7Ymx+janwnYHFnOg9VC 8vQazpgSf1EAdHzzfsBMmXYjpFWUi1A528yb6+uJJbujo4+GzPRDBaWVaUxy1Q== 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 4VJwFp52hlzxdg; Tue, 16 Apr 2024 20:13:02 +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 43GKD2Pi038563; Tue, 16 Apr 2024 20:13:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43GKD2oP038560; Tue, 16 Apr 2024 20:13:02 GMT (envelope-from git) Date: Tue, 16 Apr 2024 20:13:02 GMT Message-Id: <202404162013.43GKD2oP038560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: d6a4e4842943 - stable/14 - 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d6a4e4842943fb525061cfee34bc37a098cb7433 Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d6a4e4842943fb525061cfee34bc37a098cb7433 commit d6a4e4842943fb525061cfee34bc37a098cb7433 Author: Justin Hibbits AuthorDate: 2024-02-20 22:08:54 +0000 Commit: Warner Losh CommitDate: 2024-04-16 19:54:25 +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. (cherry picked from commit cd6e526e268e4fdf1c9a65b9d792e67343f52307) --- 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);