lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 13 Jul 2017 20:42:32 +0300
From:   Ville Syrjälä <ville.syrjala@...ux.intel.com>
To:     Stéphane Marchesin <marcheu@...omium.org>
Cc:     Matthias Kaehlcke <mka@...omium.org>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        David Airlie <airlied@...ux.ie>,
        intel-gfx <intel-gfx@...ts.freedesktop.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Michael Davidson <md@...gle.com>,
        Grant Grundler <grundler@...omium.org>,
        Greg Hackmann <ghackmann@...gle.com>,
        Daniel Vetter <daniel.vetter@...el.com>
Subject: Re: [Intel-gfx] [PATCH RESEND] drm/i915: Fix pipe/transcoder enum
 mismatches

On Thu, Jul 13, 2017 at 09:23:11AM -0700, Stéphane Marchesin wrote:
> On Thu, Jul 13, 2017 at 3:13 AM, Ville Syrjälä
> <ville.syrjala@...ux.intel.com> wrote:
> > On Wed, Jul 12, 2017 at 07:28:14PM -0700, Stéphane Marchesin wrote:
> >> On Fri, May 5, 2017 at 10:40 AM, Ville Syrjälä
> >> <ville.syrjala@...ux.intel.com> wrote:
> >> >
> >> > On Fri, May 05, 2017 at 10:26:36AM -0700, Matthias Kaehlcke wrote:
> >> > > El Thu, Apr 20, 2017 at 02:56:05PM -0700 Matthias Kaehlcke ha dit:
> >> > >
> >> > > > In several instances the driver passes an 'enum pipe' value to a
> >> > > > function expecting an 'enum transcoder' and viceversa. Since PIPE_x and
> >> > > > TRANSCODER_x have the same values this doesn't cause functional
> >> > > > problems. Still it is incorrect and causes clang to generate warnings
> >> > > > like this:
> >> > > >
> >> > > > drivers/gpu/drm/i915/intel_display.c:1844:34: warning: implicit
> >> > > >   conversion from enumeration type 'enum transcoder' to different
> >> > > >   enumeration type 'enum pipe' [-Wenum-conversion]
> >> > > >     assert_fdi_rx_enabled(dev_priv, TRANSCODER_A);
> >> > > >
> >> > > > Change the code to pass values of the type expected by the callee.
> >> > > >
> >> > > > Signed-off-by: Matthias Kaehlcke <mka@...omium.org>
> >> > > > ---
> >> > > >  drivers/gpu/drm/i915/intel_display.c | 4 ++--
> >> > > >  drivers/gpu/drm/i915/intel_dp.c      | 6 ++++--
> >> > > >  drivers/gpu/drm/i915/intel_hdmi.c    | 6 ++++--
> >> > > >  drivers/gpu/drm/i915/intel_sdvo.c    | 6 ++++--
> >> > > >  4 files changed, 14 insertions(+), 8 deletions(-)
> >> > >
> >> > > Ping, any comments on this patch?
> >> >
> >> > I'm not convinced the patch is making things any better really. To
> >> > fix this really properly, I think we'd need to introduce a new enum
> >> > pch_transcoder and thus avoid the confusion of which type of
> >> > transcoder we're talking about. Currently most places expect an
> >> > enum pipe when dealing with PCH transcoders, and enum transcoder
> >> > when dealing with CPU transcoders. But there are some exceptions
> >> > of course.
> >>
> >>
> >> I don't follow -- these functions take an enum transcoder; what's
> >> wrong about passing what they expect? It seems like what you are
> >> asking for has nothing to do with the warning here...
> >
> > There's a warning? I don't get any.
> 
> Yup, clang generates a warning.
> 
> >
> > Anyways, I just don't see much point in blindly changing the types
> > because it doesn't actually solve the underlying confusion for human
> > readers. It might even make it worse, not sure.
> 
> The function expects type A, you pass type B, how can that ever be the
> right thing to do?

Because maybe the function should be taking in type B instead.

-- 
Ville Syrjälä
Intel OTC

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ