Skip to contentSkip to conversation

2.5.62: /proc/ide/via reads return incomplete data, Bug #374

PATCH In review Faik Uygur 2 participants 4 messages Feb 20, 2003 – Mar 14, 2003 1 message not in the archive

lore
Share & tools
lore

Faik Uygur

author
#0 lore raw

PATCH 1/1 2.5.62: /proc/ide/via reads return incomplete data, Bug #374

This patch fixes the incomplete data return problem of /proc/ide/via and addresses Bug #374 of Bugzilla.

When the number of consecutive read bytes are smaller than the total data in via_get_info(), the second read() returns 0.

drivers/ide/pci/via82cxxx.c Thu Feb 20 23:09:23 2003 renamed from drivers/ide/pci/via82cxxx.c Thu Feb 20 18:51:52 2003 +5 -1
@@ -145,6 +145,7 @@
                 uen[4], udma[4], umul[4], active8b[4], recover8b[4];
        struct pci_dev *dev = bmide_dev;
        unsigned int v, u, i;
+       int len;
        u16 c, w;
        u8 t, x;
        char *p = buffer;
@@ -274,7 +275,10 @@
                speed[i] / 1000, speed[i] / 100 % 10);
 
        /* hoping it is less than 4K... */
-       return p - buffer;
+       len = (p - buffer) - offset;
+       *addr = buffer + offset;
+
+       return len > count ? count : len;
 }
 
 #endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw
Quoted 7 lines

Isn't there another problem ? As I can see the amd74xx.c has also the same return in amd74xx_get_info(..) :

	return p - buffer;

I don't have such hardware to test but there might be the same error ?

Yes, there are other drivers that have the same problem. I was planning to send patches for them, as well.
So, if this patch fixes your problem, could you please change the bug status to RESOLVED. Thanks.

author
#3 lore raw
In reply to a message not in the archive
Quoted 6 lines

Isn't there another problem ? As I can see the amd74xx.c has also the same return in amd74xx_get_info(..) :

	return p - buffer;

I don't have such hardware to test but there might be the same error ?

Ah, sorry for replying you in public, I didn't notice that you did not cc'ed to the list. Please, cc your replies to lkml, as well. Thanks.

#4 lore raw
In reply to Faik Uygur
Quoted 19 lines · Faik Uygur

This patch fixes the incomplete data return problem of /proc/ide/via and addresses Bug #374 of Bugzilla.

When the number of consecutive read bytes are smaller than the total data in via_get_info(), the second read() returns 0.

drivers/ide/pci/via82cxxx.c Thu Feb 20 23:09:23 2003 renamed from drivers/ide/pci/via82cxxx.c Thu Feb 20 18:51:52 2003 +1 -0
@@ -145,6 +145,7 @@
                 uen[4], udma[4], umul[4], active8b[4], recover8b[4];
        struct pci_dev *dev = bmide_dev;
        unsigned int v, u, i;
+       int len;
        u16 c, w;
        u8 t, x;
        char *p = buffer;
@@ -274,7 +275,10 @@
                speed[i] / 1000, speed[i] / 100 % 10);

drivers/ide/pci/via82cxxx.c Thu Feb 20 23:09:23 2003 line 284

Quoted 10 lines
drivers/ide/pci/via82cxxx.c Thu Feb 20 23:09:23 2003 renamed from drivers/ide/pci/via82cxxx.c Thu Feb 20 18:51:52 2003 +4 -1
 
        /* hoping it is less than 4K... */
-       return p - buffer;
+       len = (p - buffer) - offset;
+       *addr = buffer + offset;
+
+       return len > count ? count : len;
 }
 
 #endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */

Thanks; applied.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs