From: Mike Frysinger Date: Thu, 1 Sep 2011 10:12:06 -0400 Subject: [U-Boot] [PATCH v2] net: Check network device driver name In-Reply-To: <1314696613-31095-1-git-send-email-monstr@monstr.eu> References: <1314696613-31095-1-git-send-email-monstr@monstr.eu> Message-ID: <201109011012.06873.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tuesday, August 30, 2011 05:30:13 Michal Simek wrote: > --- a/net/eth.c > +++ b/net/eth.c > @@ -224,6 +224,14 @@ int eth_write_hwaddr(struct eth_device *dev, const > char *base_name, int eth_register(struct eth_device *dev) > { > struct eth_device *d; > + > + size_t len = strlen(dev->name); > + if (len >= NAMESIZE) { > + printf("Network driver name is too long (%zu >= %zu): %s\n", > + len, NAMESIZE, dev->name); > + return -1; > + } thinking a little more, i wonder if this wouldnt be better as an assert() or BUG_ON(). this isnt a normal issue and generally gets caught once -- during development of a new board. -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20110901/7c75798a/attachment.pgp