Re: [patch] 2.3.99-pre3-3: dev_alloc_name

From: Urban Widmark (urban@svenskatest.se)
Date: Wed Mar 22 2000 - 08:59:48 EST


On 22 Mar 2000, Nick Holloway wrote:

> cope with this. However, before it was started, I think waiting until
> this approach gets the nod from someone with the influence to get the
> patch accepted would be prudent. Alan?

I don't have the power to nod, however ...

> This comments means that all apart from 4 would need changing anyway.
> The majority only allocate 8 or 9 bytes for dev->name. Only wavelan,
> depca, ppp_generic and net_init allocate 16. Of these, only wavelan
> and net_init actually use the IFNAMSIZ size.

Everyone using net_init to allocate the net_device struct gets a dev->name
pointing to IFNAMSIZ bytes. So there are more than 4 that do this right
(3c59x, eepro100, 8139too, pcnet32, via-rhine, and a few others that do
 dev = init_etherdev(NULL/0, *) in 2.3.99-pre2)

(But I don't understand your number of 27 that needs fixing, so maybe I'm
 way off here ... :)

When using init_etherdev they also get their device private area aligned
to 32 bytes (should perhaps be adjustable with an extra argument), and all
this becomes one chunk that the driver needs to kfree at the end (a few
I've looked at don't seem to kfree what they kmalloc).

Maybe a correct fix would be to have all drivers/net create their 'dev'
struct the same way ... and init_etherdev looks like a good candidate.
The FIXME at the top of Space.c seems to agree.

> I think it would be better to byte the bullet and change "dev->name"
> from "char*" to "char[IFNAMSIZ]" and fix the net drivers properly,
> rather than fix the allocated size of "dev->name" in the majority.

Yes. I don't see the point of having a char* if it is always pointing to
the same char[] (as it would using init_etherdev).

/Urban

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:36 EST