From: "Michał Nazarewicz" <m.nazarewicz@samsung.com>
To: akpm@linux-foundation.org, torvalds@linux-foundation.org,
Evgeny Kuznetsov <EXT-Eugeny.Kuznetsov@nokia.com>
Cc: mingo@elte.hu, gregkh@suse.de, a.p.zijlstra@chello.nl,
xiaosuo@gmail.com, linux-kernel@vger.kernel.org,
ext-eugeny.kuznetsov@nokia.com
Subject: Re: [PATCH 1/1] wait: using uninitialized member of wait queue
Date: Tue, 05 Oct 2010 12:41:51 +0200 [thread overview]
Message-ID: <op.vj3mn1fl7p4s8u@pikus> (raw)
In-Reply-To: <dfd3348b7971bee89360efb85f8d622e6574b003.1286193121.git.EXT-Eugeny.Kuznetsov@nokia.com>
On Tue, 05 Oct 2010 10:47:57 +0200, Evgeny Kuznetsov <EXT-Eugeny.Kuznetsov@nokia.com> wrote:
> Member "flags" of "wait_queue_t" struct is used in several places in
> kernel code without beeing initialized. "flags" is used in bitwise operations.
^^^^^^ -- "being"
> If "flags" not initialized then unexpected behaviour may have place.
> Incorrect flags maybe used later in code.
> Struct "wait_queue_t" is initialized in function "init_wait()". But
> "init_wait()" do not initialize "flag" member.
^^ -- does ^^^^ -- "flags"
> Added initialization of "wait_queue_t.flags" with zero value into "init_wait".
> diff --git a/include/linux/wait.h b/include/linux/wait.h
> index 0836ccc..3efc9f3 100644
> --- a/include/linux/wait.h
> +++ b/include/linux/wait.h
> @@ -614,6 +614,7 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
> (wait)->private = current; \
> (wait)->func = autoremove_wake_function; \
> INIT_LIST_HEAD(&(wait)->task_list); \
> + (wait)->flags = 0; \
> } while (0)
> /**
I'd turn init_wait() into a static inline. Otherwise looks good to me.
(Interestingly, init_wait() is used only in 3 places in the kernel and
none uses flags.)
--
Best regards, _ _
| Humble Liege of Serenely Enlightened Majesty of o' \,=./ `o
| Computer Science, Michał "mina86" Nazarewicz (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
next prev parent reply other threads:[~2010-10-05 10:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-05 8:47 [PATCH 0/1] wait: using uninitialized member of wait queue Evgeny Kuznetsov
2010-10-05 8:47 ` [PATCH 1/1] " Evgeny Kuznetsov
2010-10-05 10:41 ` Michał Nazarewicz [this message]
2010-10-05 11:00 ` Evgeny Kuznetsov
2010-10-05 11:39 ` Michał Nazarewicz
2010-10-05 15:43 ` [PATCH 0/1] " Linus Torvalds
2010-10-06 6:01 ` Evgeny Kuznetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=op.vj3mn1fl7p4s8u@pikus \
--to=m.nazarewicz@samsung.com \
--cc=EXT-Eugeny.Kuznetsov@nokia.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.org \
--cc=xiaosuo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox