From: Trent Piepho <xyzzy@speakeasy.org>
To: "Németh Márton" <nm127@freemail.hu>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>,
linux-media@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] v4l2: fill the unused fields with zeros in case of VIDIOC_S_FMT
Date: Sat, 25 Apr 2009 10:53:05 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.58.0904251045070.3753@shell2.speakeasy.net> (raw)
In-Reply-To: <49F2C59A.9010703@freemail.hu>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: TEXT/PLAIN; charset=X-UNKNOWN, Size: 1238 bytes --]
On Sat, 25 Apr 2009, [UTF-8] Németh Márton wrote:
> The VIDIOC_S_FMT is a write-read ioctl: it sets the format and returns
> the current format in case of success. The parameter of VIDIOC_S_FMT
> ioctl is a pointer to struct v4l2_format. [1] This structure contains some
> fields which are not used depending on the .type value. These unused
> fields are filled with zeros with this patch.
It's a union, so it's not really the case the the fields are unused. If
it's a non-private format, the structure will have some empty padding space
at the end of the structure after the last field for the format's type.
Since it's just padding space and there are no fields defined, I don't
think we have to clear it.
> struct v4l2_format *f = (struct v4l2_format *)arg;
>
> +#define CLEAR_UNUSED_FIELDS(data, last_member) \
> + memset(((u8 *)f)+ \
> + offsetof(struct v4l2_format, fmt)+ \
> + sizeof(struct v4l2_ ## last_member), \
> + 0, \
> + sizeof(*f)- \
> + offsetof(struct v4l2_format, fmt)+ \
> + sizeof(struct v4l2_ ## last_member))
> +
What is "data" used for? The length in your memset is wrong. You didn't
run this through "make patch" did you? Because there are spacing/formatting
errors that that would have caught.
next prev parent reply other threads:[~2009-04-25 17:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-25 8:11 Németh Márton
2009-04-25 17:53 ` Trent Piepho [this message]
2009-04-26 4:54 ` Németh Márton
2009-04-26 4:55 ` Németh Márton
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=Pine.LNX.4.58.0904251045070.3753@shell2.speakeasy.net \
--to=xyzzy@speakeasy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=nm127@freemail.hu \
/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®