something to warry about...

Johannes Stezenbach js at sig21.net
Tue Jan 18 13:14:39 UTC 2011


On Tue, Jan 18, 2011 at 04:09:14PM +0300, Sergey Naumov wrote:
> 2011/1/18 Johannes Stezenbach <js at sig21.net>:
> > The following compiles cleanly (but not tested):
> >
> >  /* Link detection routines and table */
> >
> > +union mii_ifreq {
> > +       struct ifreq ifreq;
> > +       struct mii_ioctl_data mii;
> > +};
> > +
> 
> Denys has already thought about this solution:
> > union {
> >       struct ifreq ifreq;
> >       struct {
> >               char padding[offsetof(struct ifreq, ifr_data)];
> >               struct mii_ioctl_data mii;
> >       } s;
> >} u;
> 
> If struct mii_ioctl_data (or union ifr_ifru) was the first element of
> struct ifreq you could use this solution, but it wasn't.

Apparently you didn't read the full patch.


Johannes


More information about the busybox mailing list