Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3061
b: refs/heads/master
c: 2df7111
h: refs/heads/master
i:
  3059: 4cdc120
v: v3
  • Loading branch information
Kylene Hall authored and Linus Torvalds committed Jun 24, 2005
1 parent 20f2f42 commit 388264d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b44bd58063f7839f42a4047843e93e1fbf73cda
refs/heads/master: 2df7111fc6b0e050b06123379821ece2f8dd5bbc
21 changes: 15 additions & 6 deletions trunk/drivers/char/tpm/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static const u8 readpubek[] = {

static ssize_t show_pubek(struct device *dev, struct device_attribute *attr, char *buf)
{
u8 data[READ_PUBEK_RESULT_SIZE];
u8 *data;
ssize_t len;
__be32 *native_val;
int i;
Expand All @@ -266,12 +266,18 @@ static ssize_t show_pubek(struct device *dev, struct device_attribute *attr, cha
if (chip == NULL)
return -ENODEV;

data = kmalloc(READ_PUBEK_RESULT_SIZE, GFP_KERNEL);
if (!data)
return -ENOMEM;

memcpy(data, readpubek, sizeof(readpubek));
memset(data + sizeof(readpubek), 0, 20); /* zero nonce */

if ((len = tpm_transmit(chip, data, sizeof(data))) <
READ_PUBEK_RESULT_SIZE)
return len;
if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) <
READ_PUBEK_RESULT_SIZE) {
rc = len;
goto out;
}

/*
ignore header 10 bytes
Expand Down Expand Up @@ -304,7 +310,10 @@ static ssize_t show_pubek(struct device *dev, struct device_attribute *attr, cha
if ((i + 1) % 16 == 0)
str += sprintf(str, "\n");
}
return str - buf;
rc = str - buf;
out:
kfree(data);
return rc;
}

static DEVICE_ATTR(pubek, S_IRUGO, show_pubek, NULL);
Expand All @@ -330,7 +339,7 @@ static const u8 cap_manufacturer[] = {

static ssize_t show_caps(struct device *dev, struct device_attribute *attr, char *buf)
{
u8 data[READ_PUBEK_RESULT_SIZE];
u8 data[sizeof(cap_manufacturer)];
ssize_t len;
char *str = buf;

Expand Down

0 comments on commit 388264d

Please sign in to comment.