[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiDSCtjX6+xZn=YkSfqY8xTi7e=OZWbUNtuJ_d=OreFbrgaog@mail.gmail.com>
Date: Wed, 22 Feb 2023 14:14:46 +0100
From: Ricardo Ribalda <ribalda@...omium.org>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Kees Cook <keescook@...omium.org>, ionut_n2001@...oo.com,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] media: uvcvideo: Silence memcpy() run-time false positive warnings
Hi Andy
On Tue, 7 Feb 2023 at 23:07, Andy Shevchenko
<andriy.shevchenko@...el.com> wrote:
>
> On Mon, Jan 09, 2023 at 11:46:00AM +0100, Ricardo Ribalda wrote:
> > Hi Laurent
> >
> > I was thinking about something on the line of the attached patch,
> >
> > uvc_frame_header->data could also be replaced with a union.
> >
> > Warning, not tested ;)
>
> ...
>
> > +struct uvc_frame_header {
> > + u8 length;
> > + u8 flags;
> > + u8 data[];
> > +} __packed;
>
> __packed! (See below)
>
> ...
>
> > + pts = (u32 *) header->data;
>
> Ai-ai-ai.
> Here is just a yellow flag...
>
> ...
>
> > uvc_dbg(stream->dev, FRAME,
> > "%s(): t-sys %lluns, SOF %u, len %u, flags 0x%x, PTS %u, STC %u frame SOF %u\n",
> > __func__, ktime_to_ns(time), meta->sof, meta->length,
> > meta->flags,
> > + has_pts ? *pts : 0,
>
> ...and here is a red flag. What you need to have is
Thanks! you are absolutely right :)
Luckily Laurent merged the original patch not mine.
Regards!
>
> void *pts;
> u32 pts_val;
>
> pts_val = get_unaligned_be32(); // or le32
>
> ...use pts_val...
>
> > + has_scr ? scr->scr : 0,
> > + has_scr ? scr->frame_sof & 0x7ff : 0);
>
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
--
Ricardo Ribalda
Powered by blists - more mailing lists