Re: JBD-DEBUG /proc/sys entry (again)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jose R. Santos
Date: Thursday, October 4, 2007 - 3:46 pm

On Thu, 04 Oct 2007 16:28:07 +0400
Rusev <arusev@dev.rtsoft.ru> wrote:


This patch is wrong.  xlate_pro_name() is meant to check if a given
path is valid, creating new directory entries is something that need to
be handle by the code that's creating the entries.

Also note that xlate_pro_name() is also called by remove_proc_entry()
so if I call it with a bogus path, this patch will end up creating new
directory entries which is not the intended result.


This should not be done is user one step and for good reason.  If you
blindly create multiple directory entries in /proc, how are you going to
keep track of all the created entries when its time to remove them
(module unloading for example)?

If you enter an invalid path the original code is doing the right thing
by returning -ENOENT.


White space damage.


You did not check if kzalloc was successfully.  If the allocation
fails, bad things will happen here.  Need to check the return status of
my_name and return -ENOMEM if the allocation fails.  This would of
course mean an API change and you would need make sure that all the
callers of xlate_proc_name handle the new return code correctly.


1. Email client cut the line.  Disable line wrapping.
2. Line too long - Documentation/CodingStyle


Again, check for kzalloc return status.


White space damage.  To many new lines.  One is enough.


This is basically dead code since you make sure to create a directory
entry if one does not exist.  The code above makes sure you never hit
this condition, which is wrong since you should not create directory
entries blindly.  Returning -ENOENT on a invalid path is the right thing
to do here.

White space damage.
White space damage.

-JRS
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
JBD-DEBUG /proc/sys entry (again), Rusev, (Thu Oct 4, 5:28 am)
Re: JBD-DEBUG /proc/sys entry (again), Jose R. Santos, (Thu Oct 4, 3:46 pm)