[U-Boot-Users] [PATCH] Fill in remaining MTD driver data for OneNAND (take #2)

Wolfgang Denk wd at denx.de
Wed Aug 6 18:18:13 CEST 2008


In message <20080806160947.GA2640 at ld0162-tx32.am.freescale.net> you wrote:
> 
> > -	printk(KERN_INFO "%sOneNAND%s %dMB %sV 16-bit (0x%02x)\n",
> > +	sprintf(dev_info, "%sOneNAND%s %dMB %sV 16-bit (0x%02x)",
> >  	       demuxed ? "" : "Muxed ",
> >  	       ddp ? "(DDP)" : "",
> >  	       (16 << density), vcc ? "2.65/3.3" : "1.8", device);
> 
> It'd be better to use snprintf, even if you're pretty sure it won't
> overflow.

This in turn requires that you test the return code for overflowing
the buffer - otherwise there is the risk of using an unterminated
string.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A good aphorism is too hard for the tooth of time, and  is  not  worn
away  by  all  the  centuries,  although  it serves as food for every
epoch.                                  - Friedrich Wilhelm Nietzsche
                          _Miscellaneous Maxims and Opinions_ no. 168




More information about the U-Boot mailing list