Commit 61ffc94c authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] fix proc handling in sis, siimageand slc90e66

parent 4872acfd
...@@ -55,6 +55,7 @@ static char * print_siimage_get_info (char *buf, struct pci_dev *dev, int index) ...@@ -55,6 +55,7 @@ static char * print_siimage_get_info (char *buf, struct pci_dev *dev, int index)
static int siimage_get_info (char *buffer, char **addr, off_t offset, int count) static int siimage_get_info (char *buffer, char **addr, off_t offset, int count)
{ {
char *p = buffer; char *p = buffer;
int len;
u16 i; u16 i;
p += sprintf(p, "\n"); p += sprintf(p, "\n");
...@@ -62,7 +63,11 @@ static int siimage_get_info (char *buffer, char **addr, off_t offset, int count) ...@@ -62,7 +63,11 @@ static int siimage_get_info (char *buffer, char **addr, off_t offset, int count)
struct pci_dev *dev = siimage_devs[i]; struct pci_dev *dev = siimage_devs[i];
p = print_siimage_get_info(p, dev, i); p = print_siimage_get_info(p, dev, i);
} }
return p-buffer; /* => must be less than 4k! */ /* p - buffer must be less than 4k! */
len = (p - buffer) - offset;
*addr = buffer + offset;
return len > count ? count : len;
} }
#endif /* defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS) */ #endif /* defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS) */
......
...@@ -424,6 +424,7 @@ static char* get_slaves_info(char* buffer) ...@@ -424,6 +424,7 @@ static char* get_slaves_info(char* buffer)
static int sis_get_info (char *buffer, char **addr, off_t offset, int count) static int sis_get_info (char *buffer, char **addr, off_t offset, int count)
{ {
char *p = buffer; char *p = buffer;
int len;
u8 reg; u8 reg;
u16 reg2, reg3; u16 reg2, reg3;
...@@ -494,7 +495,10 @@ static int sis_get_info (char *buffer, char **addr, off_t offset, int count) ...@@ -494,7 +495,10 @@ static int sis_get_info (char *buffer, char **addr, off_t offset, int count)
p = get_masters_info(p); p = get_masters_info(p);
p = get_slaves_info(p); p = get_slaves_info(p);
return p-buffer; len = (p - buffer) - offset;
*addr = buffer + offset;
return len > count ? count : len;
} }
#endif /* defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS) */ #endif /* defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS) */
......
...@@ -34,6 +34,7 @@ static struct pci_dev *bmide_dev; ...@@ -34,6 +34,7 @@ static struct pci_dev *bmide_dev;
static int slc90e66_get_info (char *buffer, char **addr, off_t offset, int count) static int slc90e66_get_info (char *buffer, char **addr, off_t offset, int count)
{ {
char *p = buffer; char *p = buffer;
int len;
unsigned long bibma = pci_resource_start(bmide_dev, 4); unsigned long bibma = pci_resource_start(bmide_dev, 4);
u16 reg40 = 0, psitre = 0, reg42 = 0, ssitre = 0; u16 reg40 = 0, psitre = 0, reg42 = 0, ssitre = 0;
u8 c0 = 0, c1 = 0; u8 c0 = 0, c1 = 0;
...@@ -110,7 +111,11 @@ static int slc90e66_get_info (char *buffer, char **addr, off_t offset, int count ...@@ -110,7 +111,11 @@ static int slc90e66_get_info (char *buffer, char **addr, off_t offset, int count
* FIXME.... Add configuration junk data....blah blah...... * FIXME.... Add configuration junk data....blah blah......
*/ */
return p-buffer; /* => must be less than 4k! */ /* p - buffer must be less than 4k! */
len = (p - buffer) - offset;
*addr = buffer + offset;
return len > count ? count : len;
} }
#endif /* defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS) */ #endif /* defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment