From nobody Fri Jul 10 04:18:43 2026 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 4gxJVW5ccDz6kQyy for ; Fri, 10 Jul 2026 04:18:43 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxJVW3sflz3bfP for ; Fri, 10 Jul 2026 04:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783657123; 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=kx2Wh9ggQj6x82hb2LHVDt6henQBbRimf0SMqnN9B1I=; b=X6sRepxB2oeXuSfCnrg1WrtpEoGBGE19kcvbkf8l0poJ1i9L4KlDCKtpYC+Uxjtrf75ca4 l5vjJ7Qm0J4qdb3tgI1Fq65frHtGqw20byFWdqtqhNJKbZHf2nxo+vZ4GShvXV689Esf6q UM19aPhTLVf9/7mvLLbuejRDI75t6lBQiyt/Be504dAP5uGNhFia/oUu9Q9oO2d5C2ulmO CLd1MdzG0dOoQt74myA6m2g68ng7jt29zmqVuFAuutqMFEHwaScjoVu3M2CLm93V/OLnwf +h8YquAiDY16YPsYuFmwCWKC9Z7JXydwk/ELfv4VtIg+cUsLBi5oOqR3tP0sJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783657123; a=rsa-sha256; cv=none; b=dLc8BG6sse7wbrhIvbxb1HmAQ/wOAqR3e50nWRZx3e4uKf4WTGxboZvzZNAGG1Uv9yAsWu Uv0YWgt1ZRH5P16aVN65NYrtf8qlxSDpfKwp4W4EEDM97LOvnfm3fUcdZggyNg06SNUaST yuqhaoS7BEZR6RyOcpxYq/FikXiwjhgxUFyoK6hKhlJnzTUkxzEn8YO/nQiPQOEvrnCJII Cnpw7MMRFkvJDVW2nrVsHyHeJ8D4ASLiaaSxzIgqClp8qyPCU+RhQSNmHUWUvtJ7lHBnKj Kb+JBGTc3R07WB4B1ZGoIByOgDO5Tv3eBE38r1tjHN7g8xyx6+To9Xd0ZCrmzA== 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=1783657123; 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=kx2Wh9ggQj6x82hb2LHVDt6henQBbRimf0SMqnN9B1I=; b=YFebept65e9hUKBs2kHBUvq3+Q1x1zSFjY49lYhfDaXyxwYjY6kC79UmUoEJTCIcdKbKP8 MidTyxtzvuQHVVBWezwqqkWAzdZAATsLM72FcrCYPUIvQS69PHyag/X4L5ZjJJR6+L8t3Q vB/7XPkUEvMDslK7X696RcNk1kFlMsJSyWV7/qP2DY5TAhuhit4bAsQdHreiA7htWrQkBn eHpO7hX3tuVyDS0sC3nnUj8TK3F150U3DlbhguwPh+wjDAtldnRzMmBmSlZY3dWw7MM+sw 37H0JOwF177qiO3JUn9KX64bouAaSg9g/X5GvHKL39caQIR4IldoNUUJXZp++g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxJVW2cmhzfrr for ; Fri, 10 Jul 2026 04:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 332ba by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 04:18:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1d1298269d4c - main - loader.efi: Simplify the code for null decompression a little 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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/main X-Git-Reftype: branch X-Git-Commit: 1d1298269d4c6e3ce41db6265f32ff6c2faecaf7 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 04:18:43 +0000 Message-Id: <6a5072a3.332ba.105c45e1@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1d1298269d4c6e3ce41db6265f32ff6c2faecaf7 commit 1d1298269d4c6e3ce41db6265f32ff6c2faecaf7 Author: Warner Losh AuthorDate: 2026-07-10 04:04:40 +0000 Commit: Warner Losh CommitDate: 2026-07-10 04:09:41 +0000 loader.efi: Simplify the code for null decompression a little This code is simpler when we spell it the Unix way. Also, add sanity checks to make sure the offset is where we think it is. Fixes: afee781523e4 ("loader.efi: Recognize new memdisk= and memcd= options") Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58070 --- stand/efi/loader/decompress.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stand/efi/loader/decompress.c b/stand/efi/loader/decompress.c index 1e18618db6f2..5c16f7d9bb2a 100644 --- a/stand/efi/loader/decompress.c +++ b/stand/efi/loader/decompress.c @@ -335,10 +335,14 @@ null_step(decomp_state *dctx, uint8_t *buf, size_t len, size_t offset) printf("Too much data recieved!"); return (err); } + if ((uintptr_t)dctx->buf_cur - (uintptr_t)dctx->buf != offset) { + printf("OH NO! The offset is %llu but I expected %llu\n", ULL(offset), + ULL((uintptr_t)dctx->buf_cur - (uintptr_t)dctx->buf)); + return (err); + } - CHAR8 *src = buf; - CHAR8 *dst = (void*)(uintptr_t)(dctx->buf + offset); - BS->CopyMem(dst, src, len); + memcpy(dctx->buf_cur, buf, len); + dctx->buf_cur += len; return (end == dctx->size ? done : ok); }