This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Improve SG list overflow check
- From: Gary Thomas <gary at mlbassoc dot com>
- To: eCos patches <ecos-patches at ecos dot sourceware dot org>
- Date: Wed, 18 Jan 2006 08:12:15 -0700
- Subject: Improve SG list overflow check
- Organization: MLB Associates
Found by Ferenc Deak
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
Index: io/eth/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/io/eth/current/ChangeLog,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -5 -p -r1.52 -r1.53
--- io/eth/current/ChangeLog 30 Jul 2005 11:52:10 -0000 1.52
+++ io/eth/current/ChangeLog 18 Jan 2006 15:04:38 -0000 1.53
@@ -1,5 +1,10 @@
+2006-01-18 Gary Thomas <gary@mlbassoc.com>
+
+ * src/net/eth_drv.c (eth_drv_send): Better check for overflow
+ of SG list - pointed out by Ferenc Deak
+
2005-07-29 Andrew Lunn <andrew.lunn@ascom.ch>
* src/net/eth_drv.c (eth_drv_recv): Change of type to remove
compiler warning.
Index: io/eth/current/src/net/eth_drv.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/io/eth/current/src/net/eth_drv.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -5 -p -r1.32 -r1.33
--- io/eth/current/src/net/eth_drv.c 30 Jul 2005 11:52:11 -0000 1.32
+++ io/eth/current/src/net/eth_drv.c 18 Jan 2006 15:04:38 -0000 1.33
@@ -701,11 +701,11 @@ eth_drv_send(struct ifnet *ifp)
if ( cyg_io_eth_net_debug > 1)
diag_dump_buf(data, len);
END_CONSOLE();
}
#endif
- if ( MAX_ETH_DRV_SG < sg_len ) {
+ if (m->m_next && (MAX_ETH_DRV_SG <= sg_len)) {
#ifdef CYGPKG_IO_ETH_DRIVERS_WARN_NO_MBUFS
int needed = 0;
struct mbuf *m1;
for (m1 = m0; m1 ; m1 = m1->m_next) needed++;
START_CONSOLE();