* [patch] exit: silence a bogus static checker warning
@ 2014-11-18 7:44 Dan Carpenter
2014-11-18 15:39 ` Oleg Nesterov
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-11-18 7:44 UTC (permalink / raw)
To: Andrew Morton
Cc: Oleg Nesterov, Michal Hocko, Ingo Molnar, Peter Zijlstra,
Rik van Riel, Ionut Alexa, Peter Hurley, linux-kernel,
kernel-janitors
Smatch complains about this:
kernel/exit.c:543 forget_original_parent()
warn: add some parenthesis here?
I don't normally advocate changing the code to make the static checker
happy but these are normally precedence bugs so I think it's ok to put
parenthesis so it's clear the code is deliberate.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/kernel/exit.c b/kernel/exit.c
index 6192422..1192d12 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -540,7 +540,7 @@ static void forget_original_parent(struct task_struct *father)
list_for_each_entry(p, &father->children, sibling) {
for_each_thread(p, t) {
t->real_parent = reaper;
- BUG_ON(!t->ptrace != (t->parent = father));
+ BUG_ON((!t->ptrace) != (t->parent = father));
if (likely(!t->ptrace))
t->parent = t->real_parent;
if (t->pdeath_signal)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] exit: silence a bogus static checker warning
2014-11-18 7:44 [patch] exit: silence a bogus static checker warning Dan Carpenter
@ 2014-11-18 15:39 ` Oleg Nesterov
0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2014-11-18 15:39 UTC (permalink / raw)
To: Dan Carpenter
Cc: Andrew Morton, Michal Hocko, Ingo Molnar, Peter Zijlstra,
Rik van Riel, Ionut Alexa, Peter Hurley, linux-kernel,
kernel-janitors
On 11/18, Dan Carpenter wrote:
>
> Smatch complains about this:
>
> kernel/exit.c:543 forget_original_parent()
> warn: add some parenthesis here?
>
> I don't normally advocate changing the code to make the static checker
> happy but these are normally precedence bugs so I think it's ok to put
> parenthesis so it's clear the code is deliberate.
I still think that "if (!A = B)" doesn't look as a potential precedence
bug, but I won't argue.
Andrew, this fixes exit-reparent-cleanup-the-changing-of-parent.patch
in -mm tree.
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/kernel/exit.c b/kernel/exit.c
> index 6192422..1192d12 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -540,7 +540,7 @@ static void forget_original_parent(struct task_struct *father)
> list_for_each_entry(p, &father->children, sibling) {
> for_each_thread(p, t) {
> t->real_parent = reaper;
> - BUG_ON(!t->ptrace != (t->parent = father));
> + BUG_ON((!t->ptrace) != (t->parent = father));
> if (likely(!t->ptrace))
> t->parent = t->real_parent;
> if (t->pdeath_signal)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-18 15:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-18 7:44 [patch] exit: silence a bogus static checker warning Dan Carpenter
2014-11-18 15:39 ` Oleg Nesterov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).