From owner-dev-commits-src-main@freebsd.org Tue Jan 19 01:24:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 268D84DB8AF; Tue, 19 Jan 2021 01:24:56 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKWD80cdqz3n2f; Tue, 19 Jan 2021 01:24:56 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (c-98-207-126-143.hsd1.ca.comcast.net [98.207.126.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 7A12625C93; Tue, 19 Jan 2021 01:24:55 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.45.21011103 Date: Mon, 18 Jan 2021 17:24:50 -0800 Subject: Re: ad1ebbe5cea8 - main - loader: create local copy of mode list provided by vbeinfoblock From: Ravi Pokala To: Toomas Soome , , , Message-ID: <7FCB573F-0BC6-429E-919C-6A87513DBD63@panasas.com> Thread-Topic: ad1ebbe5cea8 - main - loader: create local copy of mode list provided by vbeinfoblock References: <202101160823.10G8NjEi016925@gitrepo.freebsd.org> In-Reply-To: <202101160823.10G8NjEi016925@gitrepo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 01:24:56 -0000 Hi Toomas, =EF=BB=BF-----Original Message----- From: on behalf of Toomas Soome Date: 2021-01-16, Saturday at 00:23 To: , , Subject: git: ad1ebbe5cea8 - main - loader: create local copy of mode list = provided by vbeinfoblock The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=3Dad1ebbe5cea8ffac0037966990= ddf0f80faa55d5 commit ad1ebbe5cea8ffac0037966990ddf0f80faa55d5 Author: Toomas Soome AuthorDate: 2021-01-16 10:18:32 +0000 Commit: Toomas Soome CommitDate: 2021-01-16 10:23:22 +0000 loader: create local copy of mode list provided by vbeinfoblock Apparently some systems do corrupt mode list memory area, so we nee= d to use local copy instead. ... + vbe_mode_list_size =3D (uintptr_t)p - (uintptr_t)ml; + vbe_mode_list =3D malloc(vbe_mode_list_size); + if (vbe_mode_list =3D=3D NULL) { + free(vbe); + vbe =3D NULL; + free(vbe_mode); + vbe_mode =3D NULL; + } + bcopy(ml, vbe_mode_list, vbe_mode_list_size); + + /* reset VideoModePtr, so we will not have chance to use bad data. */ + vbe->VideoModePtr =3D 0; If allocation of vbe_mode_list failed, you're freeing things that were allo= cated before it, but then you're continuing on. The very next thing you do i= s the bcopy(), which dereferences vbe_mode_list, which is NULL because of th= e allocation failure. That doesn't seem right. Thanks, Ravi (rpokala@)