autofs4: autofs4_catatonic_mode(): remove redundant null check on kfree()
PATCH 1/1 autofs4: autofs4_catatonic_mode(): remove redundant null check on kfree()
smatch analysis:
fs/autofs4/waitq.c:46 autofs4_catatonic_mode() info: redundant null
check on wq->name.name calling kfree()
--- fs/autofs4/waitq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/autofs4/waitq.c +2 -4
@@ -42,10 +42,8 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi)while (wq) { nwq = wq->next; wq->status = -ENOENT ;/* Magic is gone - report failure */ -if (wq->name.name) { -kfree (wq->name.name); - wq->name.name =NULL ; - } +kfree (wq->name.name); + wq->name.name =NULL ; wq->wait_ctr--;wake_up_interruptible (&wq->queue); wq = nwq;
Signature · 1 line
1.7.9.5
Ian Kent
maintainerQuoted 4 lines · Tim Gardner
smatch analysis:
fs/autofs4/waitq.c:46autofs4_catatonic_mode()info: redundant null
check onwq->name.namecallingkfree()
I'm not sure about this change.
autofs4_catatonic_mode() could be called when there are remaining entries in the wait queue, which is nulled, so autofs4_wait_release() won't see the the discarded waits if it is called.
Quoted 25 lines
--- fs/autofs4/waitq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)fs/autofs4/waitq.c +2
-4@@ -42,10 +42,8 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi)while (wq) { nwq = wq->next; wq->status = -ENOENT ;/* Magic is gone - report failure */ -if (wq->name.name) { -kfree (wq->name.name); - wq->name.name =NULL ; - } +kfree (wq->name.name); + wq->name.name =NULL ; wq->wait_ctr--;wake_up_interruptible (&wq->queue); wq = nwq;
Quoted 11 lines · Ian Kent
Quoted 4 lines · Tim Gardner
smatch analysis:
fs/autofs4/waitq.c:46autofs4_catatonic_mode()info: redundant null
check onwq->name.namecallingkfree()I'm not sure about this change.
autofs4_catatonic_mode()could be called when there are remaining entries in the wait queue, which is nulled, soautofs4_wait_release()won't see the the discarded waits if it is called.
Ian, this is about something else really. The patch is about the NULL check before calling kfree() -- it does the NULL check internally. It is nothing about code flow or anything else, it is about calling kfree() unconditionally regardless whenever the argument is actually NULL or non-NULL. It makes the code shorter and easier to read.
You can add my
if you want.
Quoted 31 lines
Quoted 14 lines
--- fs/autofs4/waitq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)fs/autofs4/waitq.c +0
-0@@ -42,10 +42,8 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi)while (wq) { nwq = wq->next;fs/autofs4/waitq.c void autofs4_catatonic_mode(struct autofs_sb_info *sbi) · line 49
Quoted 10 lines
fs/autofs4/waitq.c +2
-4wq->status = -ENOENT ;/* Magic is gone - report failure */ -if (wq->name.name) { -kfree (wq->name.name); - wq->name.name =NULL ; - } +kfree (wq->name.name); + wq->name.name =NULL ; wq->wait_ctr--;wake_up_interruptible (&wq->queue); wq = nwq;--
To unsubscribe from this list: send the line "unsubscribe autofs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ian Kent
maintainerQuoted 13 lines · Michael Tokarev
Quoted 11 lines · Ian Kent
Quoted 4 lines · Tim Gardner
smatch analysis:
fs/autofs4/waitq.c:46autofs4_catatonic_mode()info: redundant null
check onwq->name.namecallingkfree()I'm not sure about this change.
autofs4_catatonic_mode()could be called when there are remaining entries in the wait queue, which is nulled, soautofs4_wait_release()won't see the the discarded waits if it is called.
Quoted 5 lines
Ian, this is about something else really. The patch is about the NULL check before calling
kfree()-- it does the NULL check internally. It is nothing about code flow or anything else, it is about callingkfree()unconditionally regardless whenever the argument is actually NULL or non-NULL. It makes the code shorter and easier to read.
Oh, right, kfree() does the a NULL check since a long time now. My bad, sorry.
Quoted 4 lines
You can add my
Signed-off-by Michael Tokarev <[email protected]>
So, you would like me to forward this to Linus?
I'd be inclined to wait until the window for 3.9 opens since Linus probably has more than enough to do finalizing 3.8 right now.
Ian
13.02.2013 11:37, Ian Kent wrote:
[]
Quoted 4 lines
So, you would like me to forward this to Linus?
I'd be inclined to wait until the window for 3.9 opens since Linus probably has more than enough to do finalizing 3.8 right now.
I guess this change is anything but urgent ;)
Thanks,
/mjt