From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Kees Cook <keescook@chromium.org>,
ionut_n2001@yahoo.com, Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] media: uvcvideo: Silence memcpy() run-time false positive warnings
Date: Wed, 8 Feb 2023 00:06:49 +0200 [thread overview]
Message-ID: <Y+LLeYF7CtLjeLbt@smile.fi.intel.com> (raw)
In-Reply-To: <CANiDSCvB8vRp43A1J4BpNZveCvG66XbDmnkKZykbWSFCLX1XUQ@mail.gmail.com>
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
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
next prev parent reply other threads:[~2023-02-07 22:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-06 6:17 [PATCH] media: uvcvideo: Silence memcpy() run-time false positive warnings Kees Cook
2023-01-06 11:43 ` Ricardo Ribalda
2023-01-06 20:19 ` Kees Cook
2023-01-07 1:42 ` Laurent Pinchart
2023-01-09 10:46 ` Ricardo Ribalda
2023-02-07 22:06 ` Andy Shevchenko [this message]
2023-02-22 13:14 ` Ricardo Ribalda
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=Y+LLeYF7CtLjeLbt@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=ionut_n2001@yahoo.com \
--cc=keescook@chromium.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ribalda@chromium.org \
/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).