Skip to contentSkip to conversation

2.5.62: /proc/ide/sis returns incomplete data [15/17]

PATCH New Faik Uygur 1 participant 1 message Feb 22, 2003

lore
Share & tools
lore

Faik Uygur

author
#0 lore raw

PATCH 1/1 2.5.62: /proc/ide/sis returns incomplete data [15/17]

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

drivers/ide/pci/sis5513.c +5 -1
@@ -396,6 +396,7 @@
 static int sis_get_info (char *buffer, char **addr, off_t offset, int count)
 {
 	char *p = buffer;
+	int len;
 	u8 reg;
 	u16 reg2, reg3;
 
@@ -466,7 +467,10 @@
 	p = get_masters_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) */