linux/drivers
Trent Piepho 19c96e4b7d V4L/DVB (10811): videodev: only copy needed part of RW ioctl's parameter
There are many RW ioctls() in v4l2 where userspace only supplies one or two
of the first fields in the structure passed to the ioctl.  The driver then
fills in the rest of the fields.

Instead of copying the entire structure from userspace to the kernel we
only need to copy those fields that userspace is actually supposed to
supply.

What's more, the fields that are meant to be only be output from the driver
can be zeroed out in the videodev code, in case the driver doesn't fill
them all in.  Many of the ioctl handlers in v4l2_ioctl do this already, but
my patch does this at one common point and so all the memsets for each
ioctl can be deleted.

For VIDIOC_G_SLICED_VBI_CAP, which has one input field ('type') and other
output-only fields, the input field is near the end of the structure
instead of at the beginning.  So there is still a memset in it's ioctl
handler to zero out the beginning of the struct.

There were a couple mistakes with the existing code:
    For VIDIOC_G_AUDIO the index field was preserved, but G_AUDIO is a read
    only ioctl so nothing is copied from userspace to preserve.

    For VIDIOC_G_FREQUENCY the tuner field was not preserved like it should
    have been.  This would be a problem if there was any hardware with more
    than one tuner/modulator.

    For VIDIOC_ENUM_FRAMESIZES and VIDIOC_ENUM_FRAMEINTERVALS, none of the
    fields were preserved even though each ioctl has several field that are
    supposed to be inputs to the driver!  Obviously these ioctls don't get
    used much.  The index field is needed if the driver has multiple
    discrete sizes/rates and other fields can be used too, e.g. if the size
    depends on pixel format or frame rate depends on image size for
    example.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:05 -03:00
..
accessibility
acpi Merge branch 'core/percpu' into percpu-cpumask-x86-for-linus-2 2009-03-27 17:28:43 +01:00
amba amba: struct device - replace bus_id with dev_name(), dev_set_name() 2009-03-24 16:38:22 -07:00
ata Merge branch 'origin' into devel 2009-03-28 20:29:51 +00:00
atm atm: fix non-const printk argument 2009-03-21 19:06:51 -07:00
auxdisplay
base Merge branch 'core/percpu' into percpu-cpumask-x86-for-linus-2 2009-03-27 17:28:43 +01:00
block Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2009-03-26 16:15:31 -07:00
bluetooth
cdrom
char Merge branch 'origin' into devel 2009-03-28 20:29:51 +00:00
clocksource Merge branch 'core/percpu' into percpu-cpumask-x86-for-linus-2 2009-03-27 17:28:43 +01:00
connector
cpufreq Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq 2009-03-26 11:04:08 -07:00
cpuidle
crypto Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2009-03-26 11:04:34 -07:00
dca Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2009-03-23 09:25:58 -07:00
dio dio: struct device - replace bus_id with dev_name(), dev_set_name() 2009-03-24 16:38:22 -07:00
dma Merge branch 'origin' into devel 2009-03-28 20:29:51 +00:00
edac edac: struct device - replace bus_id with dev_name(), dev_set_name() 2009-03-24 16:38:21 -07:00
eisa Merge branch 'core/percpu' into percpu-cpumask-x86-for-linus-2 2009-03-27 17:28:43 +01:00
firewire firewire: core: optimize propagation of BROADCAST_CHANNEL 2009-03-24 20:56:52 +01:00
firmware
gpio gpio: struct device - replace bus_id with dev_name(), dev_set_name() 2009-03-24 16:38:23 -07:00
gpu Merge branch 'linus' into percpu-cpumask-x86-for-linus-2 2009-03-28 04:26:01 +01:00
hid Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6 2009-03-26 16:14:02 -07:00
hwmon
i2c Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6 2009-03-28 14:04:53 -07:00
ide Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6 2009-03-26 11:17:04 -07:00
idle
ieee1394 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 2009-03-27 18:33:56 -07:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2009-03-28 13:30:43 -07:00
input Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2009-03-28 14:03:14 -07:00
isdn Merge branch 'master' of /home/davem/src/GIT/linux-2.6/ 2009-03-26 15:23:24 -07:00
leds
lguest Merge branch 'core/percpu' into percpu-cpumask-x86-for-linus-2 2009-03-27 17:28:43 +01:00
macintosh
mca mca: struct device - replace bus_id with dev_name(), dev_set_name() 2009-03-24 16:38:23 -07:00
md dm crypt: wait for endio to complete before destruction 2009-03-16 17:44:36 +00:00
media V4L/DVB (10811): videodev: only copy needed part of RW ioctl's parameter 2009-03-30 12:43:05 -03:00
memstick
message
mfd mfd: struct device - replace bus_id with dev_name(), dev_set_name() 2009-03-24 16:38:23 -07:00
misc Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6 2009-03-28 14:04:53 -07:00
mmc Merge branch 'origin' into devel 2009-03-28 20:29:51 +00:00
mtd Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2009-03-28 14:03:14 -07:00
net Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2009-03-28 14:03:14 -07:00
nubus
of
oprofile
parisc parisc: sba_iommu: fix build bug when CONFIG_PARISC_AGP=y 2009-03-15 13:36:22 -07:00
parport
pci Merge branch 'core/percpu' into percpu-cpumask-x86-for-linus-2 2009-03-27 17:28:43 +01:00
pcmcia Merge branch 'origin' into devel 2009-03-28 20:29:51 +00:00
platform Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6 2009-03-26 16:14:02 -07:00
pnp
power ds2760_battery.c: fix division by zero 2009-03-12 16:20:23 -07:00
ps3
rapidio rapidio: struct device - replace bus_id with dev_name(), dev_set_name() 2009-03-24 16:38:21 -07:00
regulator
rtc Merge branch 'origin' into devel 2009-03-28 20:29:51 +00:00
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2009-03-28 13:30:43 -07:00
sbus sbus: Auto-load openprom module when device opened. 2009-03-13 14:30:08 -07:00
scsi Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2009-03-28 14:03:14 -07:00
serial Merge branch 'origin' into devel 2009-03-28 20:29:51 +00:00
sh maple: fix Error in kernel-doc notation 2009-03-29 08:12:39 -07:00
sn
spi Merge branch 'origin' into devel 2009-03-28 20:29:51 +00:00
ssb b43: Add BCM4307 PCI-ID 2009-03-27 20:13:20 -04:00
staging Merge branch 'topic/snd_card_new-err' into for-linus 2009-03-24 00:35:35 +01:00
tc tc: struct device - replace bus_id with dev_name(), dev_set_name() 2009-03-24 16:38:22 -07:00
telephony
thermal
uio UIO: Take offset into account when determining number of pages that can be mapped 2009-03-24 16:38:25 -07:00
usb Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2009-03-28 14:03:14 -07:00
uwb
video Merge branch 'origin' into devel 2009-03-28 20:29:51 +00:00
virtio
w1 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6 into devel 2009-03-25 18:31:35 +00:00
watchdog Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2009-03-28 14:03:14 -07:00
xen
zorro zorro: struct device - replace bus_id with dev_name(), dev_set_name() 2009-03-24 16:38:21 -07:00
Kconfig
Makefile ide/net: flip the order of SATA and network init 2009-03-28 13:06:16 -07:00