From owner-svn-src-head@FreeBSD.ORG Tue May 18 18:28:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 963821065672; Tue, 18 May 2010 18:28:17 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 853218FC18; Tue, 18 May 2010 18:28:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4IISHgn031758; Tue, 18 May 2010 18:28:17 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4IISHTn031756; Tue, 18 May 2010 18:28:17 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201005181828.o4IISHTn031756@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 18 May 2010 18:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208276 - head/sys/dev/fb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2010 18:28:17 -0000 Author: jkim Date: Tue May 18 18:28:17 2010 New Revision: 208276 URL: http://svn.freebsd.org/changeset/base/208276 Log: Remove unnecessary pointer increment. A wrong pointer may be passed to free(9) and it can cause kernel panic when there are multiple graphics controllers in the system. Tested by: Brandon Gooch (jamesbrandongooch at gmail dot com) MFC after: 3 days Modified: head/sys/dev/fb/vesa.c Modified: head/sys/dev/fb/vesa.c ============================================================================== --- head/sys/dev/fb/vesa.c Tue May 18 18:20:11 2010 (r208275) +++ head/sys/dev/fb/vesa.c Tue May 18 18:28:17 2010 (r208276) @@ -240,10 +240,10 @@ vesa_bios_post(void) /* Find the matching PCI video controller. */ dc = devclass_find("vgapci"); if (dc != NULL && devclass_get_devices(dc, &devs, &count) == 0) { - for (dev = NULL, i = 0; dev == NULL && i < count; devs++, i++) - if (device_get_flags(*devs) != 0 && - x86bios_match_device(0xc0000, *devs)) { - dev = *devs; + for (i = 0; i < count; i++) + if (device_get_flags(devs[i]) != 0 && + x86bios_match_device(0xc0000, devs[i])) { + dev = devs[i]; is_pci = 1; break; }