From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Simek Date: Fri, 02 Sep 2011 11:27:25 +0200 Subject: [U-Boot] [PATCH v2] net: Check network device driver name In-Reply-To: <201109011012.06873.vapier@gentoo.org> References: <1314696613-31095-1-git-send-email-monstr@monstr.eu> <201109011012.06873.vapier@gentoo.org> Message-ID: <4E60A17D.7020901@monstr.eu> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Mike Frysinger wrote: > 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. Just during development. Not sure if possible to do configuration run-time through custom command. If yes then it can be useful too. Michal -- Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian