From nobody Wed May 8 02:07:05 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1541875955731890.0637318928593; Sat, 10 Nov 2018 10:52:35 -0800 (PST) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.88) (envelope-from ) id 1gLYLi-0003Ic-9y; Sat, 10 Nov 2018 19:51:14 +0100 Received: from mail-qk1-f195.google.com ([209.85.222.195]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.88) (envelope-from ) id 1gLYLW-0003IO-L6 for seabios@seabios.org; Sat, 10 Nov 2018 19:51:13 +0100 Received: by mail-qk1-f195.google.com with SMTP id o89so7252290qko.0 for ; Sat, 10 Nov 2018 10:51:15 -0800 (PST) Received: from localhost ([64.9.249.65]) by smtp.gmail.com with ESMTPSA id a50sm1768804qtb.38.2018.11.10.10.51.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Nov 2018 10:51:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koconnor.net; s=google; h=from:to:subject:date:message-id; bh=IjxqqSZWMW3NLs8Bd+5xrSQ11sakto4gWL/Usw9zsIA=; b=YO3ebo2u1uhsSmLoQXRgH1l+FVX+M9NNt0/fyvXSl2l97hso6t25/DxB89WYz6dbdl V/qi4A5XX6povW3YzqFMouHf1601M6gUC/SQE+ZWYsx8+EIAWUGOQQnu/+SzN74nRoON 85hh0qncIFpNs1IhpOZypIEDJOVZHNWNd9K28= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=IjxqqSZWMW3NLs8Bd+5xrSQ11sakto4gWL/Usw9zsIA=; b=GLbjMcy+dD+PFDaJok06hMPXI/hbTYHf0FemnpAzg3GYZdLkGX5u3si+EfWBOeUnvj NwVrPQGvyUQ0GePZfdJlW8EmX/RECfpEL+XM1jRRg32HqRq5gwq92Gl+XyymqXUnJpSs JNVAq3S5vLknmbtQ0TCiCJM1tOpKIUxz2K96SUEYkMjNarRFhVn4E1qoJdws2B+A54/m DS4mAFLreN+3d2WhjwcKz+l2gMsUk9bZ01KFwEJ4ZbZOArDJ6PYvXzLVfCyXokOeUvRS L8hN0zI+TQF/+s0OnEmfbJOngzqbqtFa0uRUEXVJuyPp7GqIHqVGLQWV4qXmt832poaB BYVw== X-Gm-Message-State: AGRZ1gJUwdsRUkVrLbnuBf7xDbjBmKuNh+80q4RxDNnpG7ESC3z0rs0j H90ltqIZYjQCkE8SM6nSdiPl2ihfU+0= X-Google-Smtp-Source: AJdET5eoqFS+6pNRDkCK886PZuv1e4tq4rxfSCVPugOvqGo+ClaQC/RaaxUL4bzOYKQGY8zeuj7Ujg== X-Received: by 2002:a0c:fccf:: with SMTP id i15mr13260505qvq.69.1541875873355; Sat, 10 Nov 2018 10:51:13 -0800 (PST) From: Kevin O'Connor To: seabios@seabios.org Date: Sat, 10 Nov 2018 13:51:09 -0500 Message-Id: <20181110185109.19643-1-kevin@koconnor.net> X-Mailer: git-send-email 2.17.2 X-Spam-Score: -1.2 (-) Subject: [SeaBIOS] [PATCH] shadow: Rework bios copy code to prevent gcc array-bounds warning X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Kevin O'Connor --- src/fw/shadow.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/fw/shadow.c b/src/fw/shadow.c index 987eaf4..4c627a8 100644 --- a/src/fw/shadow.c +++ b/src/fw/shadow.c @@ -173,9 +173,9 @@ qemu_reboot(void) return; // QEMU doesn't map 0xc0000-0xfffff back to the original rom on a // reset, so do that manually before invoking a hard reset. - void *cstart =3D VSYMBOL(code32flat_start), *cend =3D VSYMBOL(code32fl= at_end); - void *hrp =3D &HaveRunPost; - if (readl(hrp + BIOS_SRC_OFFSET)) { + void *flash =3D (void*)BIOS_SRC_OFFSET; + u32 hrp =3D (u32)&HaveRunPost; + if (readl(flash + hrp)) { // There isn't a pristine copy of the BIOS at 0xffff0000 to copy if (HaveRunPost =3D=3D 3) { // In a reboot loop. Try to shutdown the machine instead. @@ -187,8 +187,9 @@ qemu_reboot(void) } else { // Copy the BIOS making sure to only reset HaveRunPost at end make_bios_writable(); - memcpy(cstart, cstart + BIOS_SRC_OFFSET, hrp - cstart); - memcpy(hrp + 4, hrp + 4 + BIOS_SRC_OFFSET, cend - (hrp + 4)); + u32 cstart =3D SYMBOL(code32flat_start), cend =3D SYMBOL(code32fla= t_end); + memcpy((void*)cstart, flash + cstart, hrp - cstart); + memcpy((void*)hrp + 4, flash + hrp + 4, cend - (hrp + 4)); barrier(); HaveRunPost =3D 0; barrier(); --=20 2.17.2 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios