From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH 2/2] drm/i915/sdvo: kfree the intel_sdvo_connector, not drm_connector, on destroy Date: Mon, 12 Nov 2012 18:48:15 +0200 Message-ID: <20121112164815.GG3791@intel.com> References: <648e4ccc5905fd977c69a8dbab0074b05bd56596.1352737835.git.jani.nikula@intel.com> <196dd61309e46034f7c0c6ce5c920c0dea7f9531.1352737835.git.jani.nikula@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id DC8619EB27 for ; Mon, 12 Nov 2012 08:48:34 -0800 (PST) Content-Disposition: inline In-Reply-To: <196dd61309e46034f7c0c6ce5c920c0dea7f9531.1352737835.git.jani.nikula@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Jani Nikula Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Mon, Nov 12, 2012 at 06:31:36PM +0200, Jani Nikula wrote: > Since the base fields in both struct intel_connector and struct > intel_sdvo_connector are at the beginning of the enclosing struct, the > pointers are essentially the same, but there is no requirement or guarant= ee > that this is always the case. Kfree the enclosing intel_sdvo_connector > pointer that was originally allocated, not the enclosed drm_connector, in > case someone ever rearranges the structs. BTW in several places the reworked (maybe also the old?) modeset code depends on the base drm struct being in the beginning of the intel specific struct. Here's one of the culprits from intel_modeset_commit_output_state(): connector->base.encoder =3D &connector->new_encoder->base; If connector->new_encoder is NULL this will generate a bogus address unless new_encoder.base is at offset 0. We should probably have some compile time asserts to prevent anyone from making a mess by accident. -- = Ville Syrj=E4l=E4 Intel OTC