summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Allyn <mark.a.allyn@intel.com>2010-12-09 09:32:38 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2010-12-09 16:37:50 -0800
commit653bf0cfa55896b74d8cbe7e561401813ca359ad (patch)
tree4da5555099717ec805b0477d03a796b859e67eb8
parentc100fa4d6142271cc6d228fd84a5da2390ec5ec1 (diff)
downloadop-kernel-dev-653bf0cfa55896b74d8cbe7e561401813ca359ad.zip
op-kernel-dev-653bf0cfa55896b74d8cbe7e561401813ca359ad.tar.gz
Staging: sep: ensure that caller id buffer is little endian
Signed-off-by: Mark Allyn <mark.a.allyn@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/sep/sep_driver.c8
-rw-r--r--drivers/staging/sep/sep_driver_config.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index 903d610..bb42b048 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -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;
}
diff --git a/drivers/staging/sep/sep_driver_config.h b/drivers/staging/sep/sep_driver_config.h
index 92338c0..b18625d 100644
--- a/drivers/staging/sep/sep_driver_config.h
+++ b/drivers/staging/sep/sep_driver_config.h
@@ -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
OpenPOWER on IntegriCloud