[LOG] Fix critical KW issue in PTI driver
authorChristophe Guerard <christophe.guerard@intel.com>
Thu, 23 Feb 2012 20:04:33 +0000 (21:04 +0100)
committerbuildbot <buildbot@intel.com>
Mon, 27 Feb 2012 15:41:44 +0000 (07:41 -0800)
BZ: 23905

Change-Id: I35c4c9c6612a51746eac4f58fbab417e2dba7107
Signed-off-by: Christophe Guerard <christophe.guerard@intel.com>
Reviewed-on: http://android.intel.com:8080/36449
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/misc/pti.c

index e0b0d36..ceaee03 100644 (file)
@@ -173,19 +173,19 @@ static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc,
         * structure is.
         */
 
-       char comm[TASK_COMM_LEN];
+       char comm[TASK_COMM_LEN+1];
        /* task information */
        if (thread_name)
-               strncpy(comm, thread_name, sizeof(comm));
+               strncpy(comm, thread_name, sizeof(comm)-1);
        else if (in_irq())
-               strncpy(comm, "hardirq", sizeof(comm));
+               strncpy(comm, "hardirq", sizeof(comm)-1);
        else if (in_softirq())
-               strncpy(comm, "softirq", sizeof(comm));
+               strncpy(comm, "softirq", sizeof(comm)-1);
        else
-               strncpy(comm, current->comm, sizeof(comm));
+               strncpy(comm, current->comm, sizeof(comm)-1);
 
        /* Absolutely ensure our buffer is zero terminated. */
-       comm[TASK_COMM_LEN-1] = 0;
+       comm[TASK_COMM_LEN] = 0;
 
        mccontrol.channel = pti_control_channel;
        pti_control_channel = (pti_control_channel + 1) & 0x7f;