From owner-freebsd-bugs@freebsd.org Fri Jul 27 12:39:50 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2F7A1049622 for ; Fri, 27 Jul 2018 12:39:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 7BA3F728C8 for ; Fri, 27 Jul 2018 12:39:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 402981049621; Fri, 27 Jul 2018 12:39:49 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E458104961D for ; Fri, 27 Jul 2018 12:39:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5586728C7 for ; Fri, 27 Jul 2018 12:39:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 0ED801C1B4 for ; Fri, 27 Jul 2018 12:39:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w6RCdl1g016490 for ; Fri, 27 Jul 2018 12:39:47 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w6RCdlsA016486 for bugs@FreeBSD.org; Fri, 27 Jul 2018 12:39:47 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 230032] Intel graphics driver fails to detect DVI output Date: Fri, 27 Jul 2018 12:39:48 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: felixstella@protonmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jul 2018 12:39:50 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D230032 --- Comment #4 from FStl --- I have found two bugs (so far) in the code of the intel driver. In /sys/dev/drm2/i915/intel_sdvo.c, in function intel_sdvo_write_cmd: Line 458: msgs =3D malloc(args_len + 3 * sizeof(*msgs), DRM_MEM_KMS, M_NOWAIT= | M_ZERO); This line is allocating "args_len" bytes plus "3 * sizeof(*msgs)" bytes of memory, which is not as intended and actually leads to memory corruption. T= he correct code should be: msgs =3D malloc((args_len + 3) * sizeof(*msgs), DRM_MEM_KMS, M_NOWA= IT | M_ZERO); Lines 493-503: ret =3D -iicbus_transfer(intel_sdvo->i2c, msgs, i+3); if (ret < 0) { DRM_DEBUG_KMS("I2c transfer returned %d\n", ret); ret =3D false; goto out; } out: free(msgs, DRM_MEM_KMS); free(buf, DRM_MEM_KMS); return ret; The function iicbus_transfer returns 0 on success, and in that case, ret = =3D -0 =3D 0 =3D false and so the function intel_sdvo_write_cmd ends up returning fals= e even when it has actually succeeded. The correct code should be: ret =3D iicbus_transfer(intel_sdvo->i2c, msgs, i+3); if (ret !=3D 0) { DRM_DEBUG_KMS("I2c transfer returned %d\n", ret); ret =3D false; } else ret =3D true; free(msgs, DRM_MEM_KMS); free(buf, DRM_MEM_KMS); return ret; Correcting these two bugs makes the intel_sdvo_get_capabilities call successful, but the intel_sdvo_set_target_input call is still unsuccessful (this call is successful on FreeBSD 10). So there are still some bugs left.= .. --=20 You are receiving this mail because: You are the assignee for the bug.=