Re: [PATCH] mce: fix warning messages about static struct mce_device

From: Ingo Molnar
Date: Thu Jan 19 2012 - 14:39:00 EST



* Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:

> Or to put it another way, even though no code takes references
> to these device structures (can you really guarantee that even
> now?), [...]

That's a good question. Do these devices get exposed to
user-space access via sysfs somehow, where such an extra
reference could materialize?

> [...] how do you prevent references being taken in future
> versions of the kernel? Calling memset while there still are
> outstanding references very definitely _is_ a bug.

Unless there's a reference i missed the 'refcounting' here is
very simple and does not exist at all.

IMHO you should not impose complexity and abstraction on code
just because. Now i don't care much about the extra pointer, but
the [NR_CPUS] array was doubly ugly (and Greg promised to fix
that, so no problems from me).

So the conclusion is that the reasons stated here don't really
apply. The one i mentioned *does* apply: the original bug was
due to sloppy life time rules of this driver buffer, and that
came back to bite us. Making it dynamic solves that kind of
problem. In that sense the warning is fine too.

Thanks,

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