aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2011-09-14 19:22:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-09-14 21:09:38 -0400
commit1ebe9dad947d3158676f5ae55fc8b4f05b85c527 (patch)
treeb1b1e6475c826056e9f994eaa843513396fce605 /drivers
parent83ede96e98f5a7eb3ed07c78cb1dd166581eb864 (diff)
drivers/misc/pti.c: give 'comm' function scope in pti_control_frame_built_and_sent()
In drivers/misc/pti.c::pti_control_frame_built_and_sent() we assign 'comm' to 'thread_name_p' if (!thread_name). The problem is that 'comm' then goes out of scope and later we use 'thread_name_p' which now refers to an out-of-scope variable. To fix that, simply move 'comm' up to have function scope. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: J Freyensee <james_p_freyensee@linux.intel.com> Cc: Jeremy Rocher <rocher.jeremy@gmail.com> Cc: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/pti.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c
index 06df1877ad0..0b56e3f4357 100644
--- a/drivers/misc/pti.c
+++ b/drivers/misc/pti.c
@@ -165,6 +165,11 @@ static void pti_write_to_aperture(struct pti_masterchannel *mc,
165static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc, 165static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc,
166 const char *thread_name) 166 const char *thread_name)
167{ 167{
168 /*
169 * Since we access the comm member in current's task_struct, we only
170 * need to be as large as what 'comm' in that structure is.
171 */
172 char comm[TASK_COMM_LEN];
168 struct pti_masterchannel mccontrol = {.master = CONTROL_ID, 173 struct pti_masterchannel mccontrol = {.master = CONTROL_ID,
169 .channel = 0}; 174 .channel = 0};
170 const char *thread_name_p; 175 const char *thread_name_p;
@@ -172,13 +177,6 @@ static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc,
172 u8 control_frame[CONTROL_FRAME_LEN]; 177 u8 control_frame[CONTROL_FRAME_LEN];
173 178
174 if (!thread_name) { 179 if (!thread_name) {
175 /*
176 * Since we access the comm member in current's task_struct,
177 * we only need to be as large as what 'comm' in that
178 * structure is.
179 */
180 char comm[TASK_COMM_LEN];
181
182 if (!in_interrupt()) 180 if (!in_interrupt())
183 get_task_comm(comm, current); 181 get_task_comm(comm, current);
184 else 182 else