From nobody Wed May 15 23:15:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1710130847448156.40216094137008; Sun, 10 Mar 2024 21:20:47 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 3B0ED21C18; Mon, 11 Mar 2024 04:20:43 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 7E73E218AC for ; Mon, 11 Mar 2024 04:20:24 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) (Authenticated sender: daniel@drv.nu) by oak.drv.nu (Postfix) with ESMTPSA id 9B21E103045; Sun, 10 Mar 2024 21:20:22 -0700 (PDT) From: Daniel Verkamp To: seabios@seabios.org Date: Sun, 10 Mar 2024 21:19:55 -0700 Message-ID: <20240311041955.833922-1-daniel@drv.nu> MIME-Version: 1.0 X-Spam-Level: ** Message-ID-Hash: H2SCHQO4UFDGK7TVGJNVLDYHZT6DRIMF X-Message-ID-Hash: H2SCHQO4UFDGK7TVGJNVLDYHZT6DRIMF X-MailFrom: daniel@drv.nu X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [SeaBIOS] [PATCH] vbe: round up save/restore size List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: / X-ZM-MESSAGEID: 1710130849942100001 Content-Type: text/plain; charset="utf-8" When calculating the size of the buffer required for the VBE state, round up rather than truncating when dividing the number of bytes to get the number of 64-byte blocks. Without this modification, the save state function will write past the end of a buffer of the size requested. Signed-off-by: Daniel Verkamp Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- vgasrc/vbe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index 66afb011..1a0948cf 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -242,7 +242,7 @@ vbe_104f04(struct bregs *regs) if (ret < 0) goto fail; if (cmd =3D=3D 0) - regs->bx =3D ret / 64; + regs->bx =3D DIV_ROUND_UP(ret, 64); regs->ax =3D 0x004f; return; fail: --=20 2.43.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org