mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Kees Cook <keescook@chromium.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Laura Abbott <labbott@redhat.com>,
	Patrik Jakobsson <patrik.r.jakobsson@gmail.com>,
	David Airlie <airlied@linux.ie>,
	Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>
Subject: Re: [PATCH] drm/gma500: Remove VLA
Date: Wed, 23 May 2018 10:44:51 +0200	[thread overview]
Message-ID: <20180523084451.GK3438@phenom.ffwll.local> (raw)
In-Reply-To: <CAGXu5jLcRqjk17BqprGsWJXqGusoR6nRSf8986w7chQ9UONKMA@mail.gmail.com>

On Fri, May 18, 2018 at 10:58:40AM -0700, Kees Cook wrote:
> On Mon, Apr 9, 2018 at 2:06 PM, Laura Abbott <labbott@redhat.com> wrote:
> >
> > There's an ongoing effort to remove VLAs[1] from the kernel to eventually
> > turn on -Wvla. Switch to a reasonable upper bound for the VLAs in
> > the gma500 driver.
> >
> > [1] https://lkml.org/lkml/2018/3/7/621
> >
> > Signed-off-by: Laura Abbott <labbott@redhat.com>
> 
> Reviewed-by: Kees Cook <keescook@chromium.org>
> 
> Daniel, can this go via you, or what's the best path for this patch?

Applied to drm-misc-next for 4.19, thanks.
-Daniel

> 
> Thanks!
> 
> -Kees
> 
> > ---
> > This was a little hard to figure out but I think 32 should be a
> > comfortable upper bound based on all the structures I saw. Of course I
> > can't test it.
> > ---
> >  drivers/gpu/drm/gma500/psb_intel_sdvo.c | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> > index 84507912be84..3d4fa9f6b94c 100644
> > --- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> > +++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> > @@ -429,13 +429,20 @@ static const char *cmd_status_names[] = {
> >         "Scaling not supported"
> >  };
> >
> > +#define MAX_ARG_LEN 32
> > +
> >  static bool psb_intel_sdvo_write_cmd(struct psb_intel_sdvo *psb_intel_sdvo, u8 cmd,
> >                                  const void *args, int args_len)
> >  {
> > -       u8 buf[args_len*2 + 2], status;
> > -       struct i2c_msg msgs[args_len + 3];
> > +       u8 buf[MAX_ARG_LEN*2 + 2], status;
> > +       struct i2c_msg msgs[MAX_ARG_LEN + 3];
> >         int i, ret;
> >
> > +       if (args_len > MAX_ARG_LEN) {
> > +               DRM_ERROR("Need to increase arg length\n");
> > +               return false;
> > +       }
> > +
> >         psb_intel_sdvo_debug_write(psb_intel_sdvo, cmd, args, args_len);
> >
> >         for (i = 0; i < args_len; i++) {
> > --
> > 2.14.3
> >
> 
> 
> 
> -- 
> Kees Cook
> Pixel Security

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

      reply	other threads:[~2018-05-23  8:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-09 21:06 Laura Abbott
2018-05-18 17:58 ` Kees Cook
2018-05-23  8:44   ` Daniel Vetter [this message]

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=20180523084451.GK3438@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrik.r.jakobsson@gmail.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

all inboxes | Powered by JetHome®