[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWmBsakEndNi0+r3NZ2xLkVt6ZhAoJGS2eWhcc1Bi20HQ@mail.gmail.com>
Date: Fri, 8 Jul 2022 22:09:00 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Hans de Goede <hdegoede@...hat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
DRI Development <dri-devel@...ts.freedesktop.org>,
Linux Fbdev development list <linux-fbdev@...r.kernel.org>,
"Linux/m68k" <linux-m68k@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/5] drm/modes: parse_cmdline: Handle empty mode name part
Hi Hans,
On Fri, Jul 8, 2022 at 10:06 PM Geert Uytterhoeven <geert@...ux-m68k.org> wrote:
> On Fri, Jul 8, 2022 at 9:28 PM Hans de Goede <hdegoede@...hat.com> wrote:
> > On 7/8/22 20:21, Geert Uytterhoeven wrote:
> > > If no mode name part was specified, mode_end is zero, and the "ret ==
> > > mode_end" check does the wrong thing.
> > >
> > > Fix this by checking for a non-zero return value instead.
> >
> > Which is wrong to do, since now if you have e.g. a mode list
> > with:
> >
> > "dblntsc",
> > "dblntsc-ff"
> >
> > in there and the cmdline contains "dblntsc-ff" then you
> > will already stop with a (wrong!) match at "dblntsc".
>
> It indeed behaves that way, and did so before, as str_has_prefix()
> checks for a matching prefix, and thus may never get to the full
> match. However, can we change that to an exact match, without
> introducing regressions?
> This can be avoided by reverse-sorting the modelist (or iterating
> backwards through a sorted modelist), though.
>
> > > While at it, skip all named mode handling when mode_end is zero, as it
> > > is futile.
> >
> > AFAICT, this is actually what needs to be done to fix this, while keeping
> > the ret == mode_end check.
>
> "ret == mode_end" or "ret" doesn't matter (except for the special
> case of mode_end is zero), as str_has_prefix() returns either zero or
> the length of the prefix. Hence it never returns a non-zero value
> smaller than the length of the prefix.
Ignore that. I finally saw what's really happening.
And I do agree with your comment.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists