+ drivers-misc-ptic-give-comm-function-scope-in-pti_control_frame_built_and_sent.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     drivers/misc/pti.c: give 'comm' function scope in pti_control_frame_built_and_sent()
has been added to the -mm tree.  Its filename is
     drivers-misc-ptic-give-comm-function-scope-in-pti_control_frame_built_and_sent.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: drivers/misc/pti.c: give 'comm' function scope in pti_control_frame_built_and_sent()
From: Jesper Juhl <jj@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
Cc: J Freyensee <james_p_freyensee@xxxxxxxxxxxxxxx>
Cc: Jeremy Rocher <rocher.jeremy@xxxxxxxxx>
Cc: Sergei Trofimovich <slyfox@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/misc/pti.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff -puN drivers/misc/pti.c~drivers-misc-ptic-give-comm-function-scope-in-pti_control_frame_built_and_sent drivers/misc/pti.c
--- a/drivers/misc/pti.c~drivers-misc-ptic-give-comm-function-scope-in-pti_control_frame_built_and_sent
+++ a/drivers/misc/pti.c
@@ -165,6 +165,11 @@ static void pti_write_to_aperture(struct
 static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc,
 					     const char *thread_name)
 {
+	/*
+	 * Since we access the comm member in current's task_struct, we only
+	 * need to be as large as what 'comm' in that structure is.
+	 */
+	char comm[TASK_COMM_LEN];
 	struct pti_masterchannel mccontrol = {.master = CONTROL_ID,
 					      .channel = 0};
 	const char *thread_name_p;
@@ -172,13 +177,6 @@ static void pti_control_frame_built_and_
 	u8 control_frame[CONTROL_FRAME_LEN];
 
 	if (!thread_name) {
-		/*
-		 * Since we access the comm member in current's task_struct,
-		 * we only need to be as large as what 'comm' in that
-		 * structure is.
-		 */
-		char comm[TASK_COMM_LEN];
-
 		if (!in_interrupt())
 			get_task_comm(comm, current);
 		else
_

Patches currently in -mm which might be from jj@xxxxxxxxxxxxx are

origin.patch
drivers-misc-ptic-give-comm-function-scope-in-pti_control_frame_built_and_sent.patch
linux-next.patch
audit-always-follow-va_copy-with-va_end.patch
drivers-gpu-vga-vgaarbc-add-missing-kfree.patch
drivers-scsi-aacraid-commctrlc-fix-mem-leak-in-aac_send_raw_srb.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux