From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
DRI Development <dri-devel@lists.freedesktop.org>,
Linux Fbdev development list <linux-fbdev@vger.kernel.org>,
"Linux/m68k" <linux-m68k@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/5] drm/modes: parse_cmdline: Handle empty mode name part
Date: Fri, 8 Jul 2022 22:09:00 +0200 [thread overview]
Message-ID: <CAMuHMdWmBsakEndNi0+r3NZ2xLkVt6ZhAoJGS2eWhcc1Bi20HQ@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdWCz4j5bxKBY-W3zWiCLRc9QP+OKco-haGH_9YUhaROgA@mail.gmail.com>
Hi Hans,
On Fri, Jul 8, 2022 at 10:06 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Fri, Jul 8, 2022 at 9:28 PM Hans de Goede <hdegoede@redhat.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@linux-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
next prev parent reply other threads:[~2022-07-08 20:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 18:21 [PATCH 0/5] drm/modes: Command line mode selection fixes and improvements Geert Uytterhoeven
2022-07-08 18:21 ` [PATCH 1/5] drm/modes: parse_cmdline: Handle empty mode name part Geert Uytterhoeven
2022-07-08 19:28 ` Hans de Goede
2022-07-08 20:06 ` Geert Uytterhoeven
2022-07-08 20:09 ` Geert Uytterhoeven [this message]
2022-07-08 18:21 ` [PATCH 2/5] drm/modes: Extract drm_mode_parse_cmdline_named_mode() Geert Uytterhoeven
2022-07-08 19:45 ` Hans de Goede
2022-07-08 20:14 ` Geert Uytterhoeven
2022-07-08 18:21 ` [PATCH 3/5] drm/modes: parse_cmdline: Make mode->*specified handling more uniform Geert Uytterhoeven
2022-07-08 18:21 ` [PATCH 4/5] drm/modes: Add support for driver-specific named modes Geert Uytterhoeven
2022-07-11 9:03 ` Thomas Zimmermann
2022-07-11 9:35 ` Maxime Ripard
2022-07-11 11:11 ` Thomas Zimmermann
2022-07-11 11:42 ` Maxime Ripard
2022-07-11 11:59 ` Geert Uytterhoeven
2022-07-11 12:02 ` Maxime Ripard
2022-07-11 12:08 ` Geert Uytterhoeven
2022-07-13 9:37 ` Maxime Ripard
2022-07-14 8:42 ` Geert Uytterhoeven
2022-07-11 9:35 ` Geert Uytterhoeven
2022-07-11 11:03 ` Thomas Zimmermann
2022-07-08 18:21 ` [PATCH 5/5] drm/modes: parse_cmdline: Add support for named modes containing dashes Geert Uytterhoeven
2022-07-08 19:36 ` [PATCH 0/5] drm/modes: Command line mode selection fixes and improvements Hans de Goede
2022-07-11 9:04 ` Thomas Zimmermann
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=CAMuHMdWmBsakEndNi0+r3NZ2xLkVt6ZhAoJGS2eWhcc1Bi20HQ@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).