mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Allyn <mark.a.allyn@intel.com>
To: linux-kernel@vger.kernel.org, greg@kroah.com,
	mark.a.allyn@intel.com, alan@linux.intel.com,
	dmitry.kasatkin@nokia.com
Subject: [PATCH 10/11] sep: ensure that caller id buffer is little endian
Date: Thu,  9 Dec 2010 09:32:38 -0800	[thread overview]
Message-ID: <1291915958-18658-1-git-send-email-mark.a.allyn@intel.com> (raw)

Signed-off-by: Mark Allyn <mark.a.allyn@intel.com>
---
 drivers/staging/sep/sep_driver.c        |    8 ++++++++
 drivers/staging/sep/sep_driver_config.h |    3 +++
 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..bb42b04 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
 
-- 
1.6.3.3


                 reply	other threads:[~2010-12-09 17:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291915958-18658-1-git-send-email-mark.a.allyn@intel.com \
    --to=mark.a.allyn@intel.com \
    --cc=alan@linux.intel.com \
    --cc=dmitry.kasatkin@nokia.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome