From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
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 [thread overview]
Message-ID: <20121112164815.GG3791@intel.com> (raw)
In-Reply-To: <196dd61309e46034f7c0c6ce5c920c0dea7f9531.1352737835.git.jani.nikula@intel.com>
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 guarantee
> 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 = &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älä
Intel OTC
next prev parent reply other threads:[~2012-11-12 16:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-12 16:31 [PATCH 1/2] drm/i915/sdvo: clean up connectors on intel_sdvo_init() failures Jani Nikula
2012-11-12 16:31 ` [PATCH 2/2] drm/i915/sdvo: kfree the intel_sdvo_connector, not drm_connector, on destroy Jani Nikula
2012-11-12 16:48 ` Ville Syrjälä [this message]
2012-11-22 13:10 ` Daniel Vetter
2012-11-12 16:52 ` [PATCH 1/2] drm/i915/sdvo: clean up connectors on intel_sdvo_init() failures Chris Wilson
2012-11-12 19:09 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121112164815.GG3791@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox