[PATCH] powerpc: Add of_register_i2c_devices()

Guennadi Liakhovetski g.liakhovetski at gmx.de
Wed Aug 1 15:41:45 EST 2007


On Wed, 1 Aug 2007, Segher Boessenkool wrote:

> > > > +		strncpy(info->driver_name, i2c_devices[i].i2c_driver,
> > > > KOBJ_NAME_LEN);
> > > > +		strncpy(info->type, i2c_devices[i].i2c_type, I2C_NAME_SIZE);
> > > 
> > > Why not just strcpy(), btw?
> > 
> > Because target strings are finite length, and sources are just pointers to
> > some constant strings, which one might make arbitrarily long.
> 
> So it's no problem if the name or type string gets cut short?
> Just checking :-)

Then it just won't match. Which is also the expected behaviour, IMHO, if 
someone specifies a name longer than possible maximum length of the 
variable it should match.

Have I passed or failed?:-)

Thanks
Guennadi
---
Guennadi Liakhovetski



More information about the Linuxppc-dev mailing list