From owner-dev-commits-src-main@freebsd.org Tue Jan 19 06:25:33 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 AF5774E87CA for ; Tue, 19 Jan 2021 06:25:33 +0000 (UTC) (envelope-from tsoome@me.com) Received: from st43p00im-ztdg10061801.me.com (st43p00im-ztdg10061801.me.com [17.58.63.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKdv14PQLz4j2f for ; Tue, 19 Jan 2021 06:25:33 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by st43p00im-ztdg10061801.me.com (Postfix) with ESMTPSA id 6E3DD8C0463; Tue, 19 Jan 2021 06:25:31 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: ad1ebbe5cea8 - main - loader: create local copy of mode list provided by vbeinfoblock From: Toomas Soome In-Reply-To: <7FCB573F-0BC6-429E-919C-6A87513DBD63@panasas.com> Date: Tue, 19 Jan 2021 08:25:28 +0200 Cc: Toomas Soome , "" , "" , "" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202101160823.10G8NjEi016925@gitrepo.freebsd.org> <7FCB573F-0BC6-429E-919C-6A87513DBD63@panasas.com> To: Ravi Pokala X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-19_01:2021-01-18, 2021-01-19 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2006250000 definitions=main-2101190039 X-Rspamd-Queue-Id: 4DKdv14PQLz4j2f X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] 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 06:25:33 -0000 > On 19. Jan 2021, at 03:24, Ravi Pokala wrote: >=20 > Hi Toomas, >=20 > =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 >=20 > The branch main has been updated by tsoome: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dad1ebbe5cea8ffac0037966990ddf0f8= 0faa55d5 >=20 > commit ad1ebbe5cea8ffac0037966990ddf0f80faa55d5 > Author: Toomas Soome > AuthorDate: 2021-01-16 10:18:32 +0000 > Commit: Toomas Soome > CommitDate: 2021-01-16 10:23:22 +0000 >=20 > loader: create local copy of mode list provided by vbeinfoblock >=20 > Apparently some systems do corrupt mode list memory area, so we = need > to use local copy instead. >=20 > ... >=20 > + 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; >=20 > If allocation of vbe_mode_list failed, you're freeing things that were = allocated before it, but then you're continuing on. The very next thing = you do is the bcopy(), which dereferences vbe_mode_list, which is NULL = because of the allocation failure. >=20 > That doesn't seem right. >=20 > Thanks, >=20 > Ravi (rpokala@) >=20 >=20 yes, thanks! I do have fix waiting for any additional comments (Yuri = Pankov was very kind to provide review feedback). So the update will be = posted soon. thanks, toomas