shithub: riscv

Download patch

ref: 8a7a6f778dec447480683186dcc43c7e406e7465
parent: ad993a2618e4265e4282bdb5faa583fffa6163e3
author: cinap_lenrek <[email protected]>
date: Mon Sep 16 23:08:32 EDT 2013

ether8169, etherdp83820, ethervt6102: fix snprint READSTR bugs (thanks pap)

should probably use seprint() instead.

--- a/sys/src/9/pc/ether8169.c
+++ b/sys/src/9/pc/ether8169.c
@@ -585,7 +585,7 @@
 	l += snprint(p+l, READSTR-l, "multicast: %ud\n", ctlr->mcast);
 
 	if(ctlr->mii != nil && ctlr->mii->curphy != nil){
-		l += snprint(p+l, READSTR, "phy:   ");
+		l += snprint(p+l, READSTR-l, "phy:   ");
 		for(i = 0; i < NMiiPhyr; i++){
 			if(i && ((i & 0x07) == 0))
 				l += snprint(p+l, READSTR-l, "\n       ");
--- a/sys/src/9/pc/etherdp83820.c
+++ b/sys/src/9/pc/etherdp83820.c
@@ -937,7 +937,7 @@
 	l += snprint(p+l, READSTR-l, "tfu %d\n", ctlr->tfu);
 	l += snprint(p+l, READSTR-l, "txa %d\n", ctlr->txa);
 
-	l += snprint(p+l, READSTR, "rom:");
+	l += snprint(p+l, READSTR-l, "rom:");
 	for(i = 0; i < 0x10; i++){
 		if(i && ((i & 0x07) == 0))
 			l += snprint(p+l, READSTR-l, "\n    ");
@@ -946,7 +946,7 @@
 	l += snprint(p+l, READSTR-l, "\n");
 
 	if(ctlr->mii != nil && ctlr->mii->curphy != nil){
-		l += snprint(p+l, READSTR, "phy:");
+		l += snprint(p+l, READSTR-l, "phy:");
 		for(i = 0; i < NMiiPhyr; i++){
 			if(i && ((i & 0x07) == 0))
 				l += snprint(p+l, READSTR-l, "\n    ");
--- a/sys/src/9/pc/ethervt6102.c
+++ b/sys/src/9/pc/ethervt6102.c
@@ -371,7 +371,7 @@
 	l += snprint(p+l, READSTR-l, "tft: %ud\n", ctlr->tft);
 
 	if(ctlr->mii != nil && ctlr->mii->curphy != nil){
-		l += snprint(p+l, READSTR, "phy:   ");
+		l += snprint(p+l, READSTR-l, "phy:   ");
 		for(i = 0; i < NMiiPhyr; i++){
 			if(i && ((i & 0x07) == 0))
 				l += snprint(p+l, READSTR-l, "\n       ");