Skip to content

Commit

Permalink
Staging: sep: ensure that caller id buffer is little endian
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Allyn <mark.a.allyn@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Mark Allyn authored and Greg Kroah-Hartman committed Dec 10, 2010
1 parent c100fa4 commit 653bf0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/staging/sep/sep_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ static int sep_set_caller_id_handler(struct sep_device *sep, unsigned long arg)
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);
Expand All @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/staging/sep/sep_driver_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 653bf0c

Please sign in to comment.