From 185b8e246f4651850cad12aaa5d2c50946b7dcdb Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Wed, 16 Apr 2003 00:11:22 -0700 Subject: sysfs: Rewrite binary file handling. From Matthew Wilcox. - Remove sysfs_bin_buffer. It's a security hole. - Remove checks for permissions; the VFS does that. - Validate offset & count at the top level. - Allow lower levels to return less data than was asked for. - Allocate buffer at open & free it at close, not on each read/write. --- include/linux/sysfs.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 3e9565e2abe1..d639e18caa91 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -16,18 +16,11 @@ struct attribute { mode_t mode; }; -struct sysfs_bin_buffer { - u8 * data; - size_t size; - size_t count; - loff_t offset; -}; - struct bin_attribute { struct attribute attr; size_t size; - ssize_t (*read)(struct kobject *, struct sysfs_bin_buffer *); - ssize_t (*write)(struct kobject *, struct sysfs_bin_buffer *); + ssize_t (*read)(struct kobject *, char *, loff_t, size_t); + ssize_t (*write)(struct kobject *, char *, loff_t, size_t); }; struct sysfs_ops { -- cgit v1.2.3 From 8c4043ac9263cb1447dd6f31d6e28ab009c6a86c Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Tue, 13 May 2003 02:38:37 -0700 Subject: driver model: Define BUS_ID_SIZE based on KOBJ_NAME_LEN From Ben Collins. --- include/linux/device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/device.h b/include/linux/device.h index 208d615b103d..aa01d65e4576 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -35,7 +35,7 @@ #define DEVICE_NAME_SIZE 50 #define DEVICE_NAME_HALF __stringify(20) /* Less than half to accommodate slop */ #define DEVICE_ID_SIZE 32 -#define BUS_ID_SIZE 20 +#define BUS_ID_SIZE KOBJ_NAME_LEN enum { -- cgit v1.2.3 From 4352430976a0b40351483cd8d3a2091dde8d9582 Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Wed, 14 May 2003 18:39:47 -0700 Subject: driver model: Add resources to struct platform_device. From Russell King: The location and interrupt of some platform devices are only known by platform specific code. In order to avoid putting platform specific parameters into drivers, place resource and irq members into struct platform_device. --- include/linux/device.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/linux/device.h b/include/linux/device.h index aa01d65e4576..4c0c364aabc6 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -388,6 +389,8 @@ struct platform_device { char * name; u32 id; struct device dev; + struct resource res; + unsigned int irq; }; extern int platform_device_register(struct platform_device *); -- cgit v1.2.3