From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 2/3] drm/i915/sdvo: Robustify the dtd<->drm_mode conversions
Date: Tue, 10 Sep 2013 14:00:27 +0300 [thread overview]
Message-ID: <20130910110027.GM11428@intel.com> (raw)
In-Reply-To: <CAKMK7uHfgPYOXX4c0t20izki1L=nfAVQ1ErwrEqvRu-04ZKz-w@mail.gmail.com>
On Tue, Sep 10, 2013 at 12:50:25PM +0200, Daniel Vetter wrote:
> On Tue, Sep 10, 2013 at 12:26 PM, Ville Syrjälä
> <ville.syrjala@linux.intel.com> wrote:
> >> static void intel_sdvo_get_mode_from_dtd(struct drm_display_mode * mode,
> >> const struct intel_sdvo_dtd *dtd)
> >> {
> >> + memset(mode, 0, sizeof(*mode));
> >
> > I have a theoretical worry that someone might end up calling this on a
> > mode that sits on some list or was actually allocated and has a proper
> > object id which we'd leak here.
> >
> > To make it totally safe you could populate a pristine mode struct and
> > use drm_mode_copy() to overwrite adjusted_mode. Assuming we're not so
> > short on stack space that our oversized mode struct would cause issues.
> > Other options would be to add some WARNs to catch wrongdoers, or embed
> > a temp mode for this purpose inside the intel_sdvo struct.
>
> We can't really check for this since list_empty on stack garbage won't
> work too well, either. And e.g. ->get_config has the pipe config on
> the stack. So I think we just need to do review here. I also think the
> risk is pretty low, this is all used in internal structures around
> pipe_config, where the mode is never linked.
Well, another idea would be to add drm_mode_clear() what would do the
memset() but preserve the id and list head.
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2013-09-10 11:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-10 10:06 [PATCH 1/3] drm/i915/sdvo: Fully translate sync flags in the dtd->mode conversion Daniel Vetter
2013-09-10 10:06 ` [PATCH 2/3] drm/i915/sdvo: Robustify the dtd<->drm_mode conversions Daniel Vetter
2013-09-10 10:26 ` Ville Syrjälä
2013-09-10 10:50 ` Daniel Vetter
2013-09-10 11:00 ` Ville Syrjälä [this message]
2013-09-10 12:26 ` Daniel Vetter
2013-09-10 12:44 ` Ville Syrjälä
2013-09-10 10:51 ` [PATCH] " Daniel Vetter
2013-09-10 10:54 ` [PATCH 1/2] " Daniel Vetter
2013-09-10 10:54 ` [PATCH 2/2] drm/i915/dvo: set crtc timings again for panel fixed modes Daniel Vetter
2013-09-10 10:06 ` [PATCH 3/3] " 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=20130910110027.GM11428@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
/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