Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: src/tspi/tsp_policy.c

Issue 3581012: Upgrade from trousers 0.3.3 to 0.3.6 and from testsuite 0.2 to 0.3. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/trousers.git
Patch Set: git cl push Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/tspi/tsp_migration.c ('k') | src/tspi/tsp_ps.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/tspi/tsp_policy.c
diff --git a/src/tspi/tsp_policy.c b/src/tspi/tsp_policy.c
index 3b8d05e51de24aae782735f8fdf1787b4a9e07ca..9d5ec5da25bb29909fa1bbf70000d7a91078eb8f 100644
--- a/src/tspi/tsp_policy.c
+++ b/src/tspi/tsp_policy.c
@@ -26,6 +26,10 @@
#include "tsplog.h"
#include "obj.h"
+#define PGSIZE sysconf(_SC_PAGESIZE)
+#define PGOFFSET (PGSIZE - 1)
+#define PGMASK (~PGOFFSET)
+
/*
* popup_GetSecret()
*
@@ -43,7 +47,7 @@ popup_GetSecret(UINT32 new_pin, UINT32 hash_mode, BYTE *popup_str, void *auth_ha
{
BYTE secret[UI_MAX_SECRET_STRING_LENGTH] = { 0 };
BYTE *dflt = (BYTE *)"TSS Authentication Dialog";
- UINT32 secret_len;
+ UINT32 secret_len = 0;
TSS_RESULT result;
if (popup_str == NULL)
@@ -88,6 +92,8 @@ pin_mem(void *addr, size_t len)
return 0;
}
+ len += (uintptr_t)addr & PGOFFSET;
+ addr = (void *)((uintptr_t)addr & PGMASK);
if (mlock(addr, len) == -1) {
LogError("mlock: %s", strerror(errno));
return 1;
@@ -104,6 +110,8 @@ unpin_mem(void *addr, size_t len)
return 0;
}
+ len += (uintptr_t)addr & PGOFFSET;
+ addr = (void *)((uintptr_t)addr & PGMASK);
if (munlock(addr, len) == -1) {
LogError("mlock: %s", strerror(errno));
return 1;
« no previous file with comments | « src/tspi/tsp_migration.c ('k') | src/tspi/tsp_ps.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698