diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-10-15 15:16:53 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-10-31 06:40:52 -0400 |
commit | b2c0a2ac3e59f4764c59c23bd90b571e44256030 (patch) | |
tree | b42fc9ccf784a8948161350b01354d0ce3f7b6e8 /drivers | |
parent | 19593ffdb6daa6ba691d247a2400cece12687c52 (diff) |
firewire: cdev: reduce stack usage by ioctl_dispatch
Replace a hardcoded buffer size by a sizeof union {}. This shrinks the
stack-allocated ioctl argument buffer from 256 to 40 bytes. (This is
not much, but subsequent stack usage particularly by the queue_iso ioctl
handler adds up.)
The new form is also easier to keep up to date than a hardcoded size if
more ioctls are added.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/firewire/core-cdev.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 1accfaf96c6f..e7290928a900 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c | |||
@@ -1299,7 +1299,23 @@ static int (* const ioctl_handlers[])(struct client *client, void *buffer) = { | |||
1299 | static int dispatch_ioctl(struct client *client, | 1299 | static int dispatch_ioctl(struct client *client, |
1300 | unsigned int cmd, void __user *arg) | 1300 | unsigned int cmd, void __user *arg) |
1301 | { | 1301 | { |
1302 | char buffer[256]; | 1302 | char buffer[sizeof(union { |
1303 | struct fw_cdev_get_info _00; | ||
1304 | struct fw_cdev_send_request _01; | ||
1305 | struct fw_cdev_allocate _02; | ||
1306 | struct fw_cdev_deallocate _03; | ||
1307 | struct fw_cdev_send_response _04; | ||
1308 | struct fw_cdev_initiate_bus_reset _05; | ||
1309 | struct fw_cdev_add_descriptor _06; | ||
1310 | struct fw_cdev_remove_descriptor _07; | ||
1311 | struct fw_cdev_create_iso_context _08; | ||
1312 | struct fw_cdev_queue_iso _09; | ||
1313 | struct fw_cdev_start_iso _0a; | ||
1314 | struct fw_cdev_stop_iso _0b; | ||
1315 | struct fw_cdev_get_cycle_timer _0c; | ||
1316 | struct fw_cdev_allocate_iso_resource _0d; | ||
1317 | struct fw_cdev_send_stream_packet _13; | ||
1318 | })]; | ||
1303 | int ret; | 1319 | int ret; |
1304 | 1320 | ||
1305 | if (_IOC_TYPE(cmd) != '#' || | 1321 | if (_IOC_TYPE(cmd) != '#' || |