]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Staging: sep: ensure that caller id buffer is little endian
authorMark Allyn <mark.a.allyn@intel.com>
Thu, 9 Dec 2010 17:32:38 +0000 (09:32 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 10 Dec 2010 00:37:50 +0000 (16:37 -0800)
Signed-off-by: Mark Allyn <mark.a.allyn@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/sep/sep_driver.c
drivers/staging/sep/sep_driver_config.h

index 903d6106c0d3992d0475ea8ba41fa9b09de714a7..bb42b048f46a11be5d39fa1ca2a20cb57364b1a0 100644 (file)
@@ -897,6 +897,7 @@ end_function:
 static int sep_set_current_caller_id(struct sep_device *sep)
 {
        int i;
+       u32 *hash_buf_ptr;
 
        dev_dbg(&sep->pdev->dev, "sep_set_current_caller_id start\n");
        dev_dbg(&sep->pdev->dev, "current process is %d\n", current->pid);
@@ -915,6 +916,13 @@ static int sep_set_current_caller_id(struct sep_device *sep)
                        break;
                }
        }
+       /* Ensure data is in little endian */
+       hash_buf_ptr = (u32 *)sep->shared_addr +
+               SEP_CALLER_ID_OFFSET_BYTES;
+
+       for (i = 0; i < SEP_CALLER_ID_HASH_SIZE_IN_WORDS; i++)
+               hash_buf_ptr[i] = cpu_to_le32(hash_buf_ptr[i]);
+
        dev_dbg(&sep->pdev->dev, "sep_set_current_caller_id end\n");
        return 0;
 }
index 92338c0f6bd2371d713d8c117ed2a14d1e04aad0..b18625d2f7f423a79e4b2fe582a6c768db273a01 100644 (file)
@@ -201,6 +201,9 @@ held by the proccess (struct file) */
 /* size of the caller id hash (sha2) */
 #define SEP_CALLER_ID_HASH_SIZE_IN_BYTES                      32
 
+/* size of the caller id hash (sha2) in 32 bit words */
+#define SEP_CALLER_ID_HASH_SIZE_IN_WORDS                8
+
 /* maximum number of entries in the caller id table */
 #define SEP_CALLER_ID_TABLE_NUM_ENTRIES                       20