lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.58.0904251045070.3753@shell2.speakeasy.net>
Date:	Sat, 25 Apr 2009 10:53:05 -0700 (PDT)
From:	Trent Piepho <xyzzy@...akeasy.org>
To:	Németh Márton <nm127@...email.hu>
cc:	Mauro Carvalho Chehab <mchehab@...radead.org>,
	linux-media@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] v4l2: fill the unused fields with zeros in case of
 VIDIOC_S_FMT

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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ