Re: [RFC Patch 1/1] trace_printk and trace_dump interface - v2

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: K.Prasad <prasad@...>
Cc: <linux-kernel@...>, <dwilder@...>, <prasad@...>
Date: Monday, May 19, 2008 - 7:21 pm

On Sat, 17 May 2008 07:52:16 +0530
"K.Prasad" <prasad@linux.vnet.ibm.com> wrote:


The patch is wordwrapped and space-stuffed.


list_for_each_entry_safe()?


This can leak `temp'.

I suspect it has an off-by-one.

You should check the incoming args before allocating any resources or
doing anything which has side-effects.


then use kstrdup().

Please don't call variables "temp" or "tmp".  Surely something more
communcative can be thought up.


list_for_each_entry()?


I wonder if the whole "trace_*" namespace was a good choice.  There are
other trace patches in-kernel, out-of-kernel and presumably in our
future.


list_for_each_entry_safe()?


Two callsites, far too large to be inlined.

Please just don't use inline at all, except in exceptional
circumstances.  The compiler will work it out for normal usage.


So I look at this and wonder "why did that need initialising?"


ah, because you got a compiler warning.

That's why we have "uninitialized_var()": so the reader can understand
what is happening.  Plus uninitialized_var() generates no code, whereas
that assignment generates additional text.

uninitialized_var() is fairly sucky, but adding a mysterious,
seemingly-unneeded and code-generating "= 0" is suckier.


there too.


Making a callee's locking behaviour dependent upon an incoming argument
is considered poor style and earns nastygrams from Linus.  Is there no
sane alternative?


Do init_module() and cleanup_module() actually get called?  We _used_
to have magic code which automatically calls those functions but I'd
have thought it got removed years ago?

Anyway, we should be using module_init() and module_exit() here, and
those functions should have static scope.


wordwrapping...

I often fix it, but I think we need v3 on this one.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [RFC Patch 1/1] trace_printk and trace_dump interface - v2, Andrew Morton, (Mon May 19, 7:21 pm)