2003-02-22 23:19:00

by Faik Uygur

[permalink] [raw]
Subject: [PATCH] 2.5.62: /proc/ide/svwks returns incomplete data [13/17]

This patch fixes the incomplete data return problem of /proc/ide/svwks.
When the number of consecutive read bytes are smaller than the total
data in svwks_get_info(), the second read() returns 0.

--- linux-2.5.62-vanilla/drivers/ide/pci/serverworks.c Sat Feb 22 23:00:40 2003
+++ linux-2.5.62/drivers/ide/pci/serverworks.c Sat Feb 22 23:40:36 2003
@@ -54,7 +54,7 @@
static int svwks_get_info (char *buffer, char **addr, off_t offset, int count)
{
char *p = buffer;
- int i;
+ int i, len;

p += sprintf(p, "\n "
"ServerWorks OSB4/CSB5/CSB6\n");
@@ -192,7 +192,11 @@
}
p += sprintf(p, "\n");

- 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_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS) */