Skip to content

Commit

Permalink
driver/char/tpm: declare internal symbols as static
Browse files Browse the repository at this point in the history
This patch declares the internal struct and functions as static to provide
more security.

Signed-off-by: Xiaoyan Zhang <xiaoyan.zhang@intel.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Kent Yoder <key@linux.vnet.ibm.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
  • Loading branch information
Xiaoyan Zhang authored and James Morris committed Sep 4, 2012
1 parent f84fdff commit 8119807
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions drivers/char/tpm/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ EXPORT_SYMBOL_GPL(tpm_show_pcrs);

#define READ_PUBEK_RESULT_SIZE 314
#define TPM_ORD_READPUBEK cpu_to_be32(124)
struct tpm_input_header tpm_readpubek_header = {
static struct tpm_input_header tpm_readpubek_header = {
.tag = TPM_TAG_RQU_COMMAND,
.length = cpu_to_be32(30),
.ordinal = TPM_ORD_READPUBEK
Expand Down Expand Up @@ -1395,7 +1395,7 @@ EXPORT_SYMBOL_GPL(tpm_dev_vendor_release);
* Once all references to platform device are down to 0,
* release all allocated structures.
*/
void tpm_dev_release(struct device *dev)
static void tpm_dev_release(struct device *dev)
{
struct tpm_chip *chip = dev_get_drvdata(dev);

Expand Down
37 changes: 19 additions & 18 deletions drivers/char/tpm/tpm_ppi.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ static inline void ppi_assign_params(union acpi_object params[4],
params[3].package.elements = NULL;
}

ssize_t tpm_show_ppi_version(struct device *dev, struct device_attribute *attr,
char *buf)
static ssize_t tpm_show_ppi_version(struct device *dev,
struct device_attribute *attr, char *buf)
{
acpi_handle handle;
acpi_status status;
Expand Down Expand Up @@ -82,9 +82,8 @@ ssize_t tpm_show_ppi_version(struct device *dev, struct device_attribute *attr,
return status;
}

ssize_t tpm_show_ppi_request(struct device *dev,
struct device_attribute *attr,
char *buf)
static ssize_t tpm_show_ppi_request(struct device *dev,
struct device_attribute *attr, char *buf)
{
acpi_handle handle;
acpi_status status;
Expand Down Expand Up @@ -132,9 +131,9 @@ ssize_t tpm_show_ppi_request(struct device *dev,
return status;
}

ssize_t tpm_store_ppi_request(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
static ssize_t tpm_store_ppi_request(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
char version[PPI_VERSION_LEN + 1];
acpi_handle handle;
Expand Down Expand Up @@ -207,9 +206,9 @@ ssize_t tpm_store_ppi_request(struct device *dev,
return status;
}

ssize_t tpm_show_ppi_transition_action(struct device *dev,
struct device_attribute *attr,
char *buf)
static ssize_t tpm_show_ppi_transition_action(struct device *dev,
struct device_attribute *attr,
char *buf)
{
char version[PPI_VERSION_LEN + 1];
acpi_handle handle;
Expand Down Expand Up @@ -269,9 +268,9 @@ ssize_t tpm_show_ppi_transition_action(struct device *dev,
return status;
}

ssize_t tpm_show_ppi_response(struct device *dev,
struct device_attribute *attr,
char *buf)
static ssize_t tpm_show_ppi_response(struct device *dev,
struct device_attribute *attr,
char *buf)
{
acpi_handle handle;
acpi_status status;
Expand Down Expand Up @@ -413,14 +412,16 @@ static ssize_t show_ppi_operations(char *buf, u32 start, u32 end)
return str - buf;
}

ssize_t tpm_show_ppi_tcg_operations(struct device *dev,
struct device_attribute *attr, char *buf)
static ssize_t tpm_show_ppi_tcg_operations(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return show_ppi_operations(buf, 0, PPI_TPM_REQ_MAX);
}

ssize_t tpm_show_ppi_vs_operations(struct device *dev,
struct device_attribute *attr, char *buf)
static ssize_t tpm_show_ppi_vs_operations(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return show_ppi_operations(buf, PPI_VS_REQ_START, PPI_VS_REQ_END);
}
Expand Down

0 comments on commit 8119807

Please sign in to comment.