Skip to content

Commit 8119807

Browse files
Xiaoyan ZhangJames Morris
authored andcommitted
driver/char/tpm: declare internal symbols as static
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>
1 parent f84fdff commit 8119807

2 files changed

Lines changed: 21 additions & 20 deletions

File tree

‎drivers/char/tpm/tpm.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ EXPORT_SYMBOL_GPL(tpm_show_pcrs);
915915

916916
#define READ_PUBEK_RESULT_SIZE 314
917917
#define TPM_ORD_READPUBEK cpu_to_be32(124)
918-
struct tpm_input_header tpm_readpubek_header = {
918+
static struct tpm_input_header tpm_readpubek_header = {
919919
.tag = TPM_TAG_RQU_COMMAND,
920920
.length = cpu_to_be32(30),
921921
.ordinal = TPM_ORD_READPUBEK
@@ -1395,7 +1395,7 @@ EXPORT_SYMBOL_GPL(tpm_dev_vendor_release);
13951395
* Once all references to platform device are down to 0,
13961396
* release all allocated structures.
13971397
*/
1398-
void tpm_dev_release(struct device *dev)
1398+
static void tpm_dev_release(struct device *dev)
13991399
{
14001400
struct tpm_chip *chip = dev_get_drvdata(dev);
14011401

‎drivers/char/tpm/tpm_ppi.c‎

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ static inline void ppi_assign_params(union acpi_object params[4],
5353
params[3].package.elements = NULL;
5454
}
5555

56-
ssize_t tpm_show_ppi_version(struct device *dev, struct device_attribute *attr,
57-
char *buf)
56+
static ssize_t tpm_show_ppi_version(struct device *dev,
57+
struct device_attribute *attr, char *buf)
5858
{
5959
acpi_handle handle;
6060
acpi_status status;
@@ -82,9 +82,8 @@ ssize_t tpm_show_ppi_version(struct device *dev, struct device_attribute *attr,
8282
return status;
8383
}
8484

85-
ssize_t tpm_show_ppi_request(struct device *dev,
86-
struct device_attribute *attr,
87-
char *buf)
85+
static ssize_t tpm_show_ppi_request(struct device *dev,
86+
struct device_attribute *attr, char *buf)
8887
{
8988
acpi_handle handle;
9089
acpi_status status;
@@ -132,9 +131,9 @@ ssize_t tpm_show_ppi_request(struct device *dev,
132131
return status;
133132
}
134133

135-
ssize_t tpm_store_ppi_request(struct device *dev,
136-
struct device_attribute *attr,
137-
const char *buf, size_t count)
134+
static ssize_t tpm_store_ppi_request(struct device *dev,
135+
struct device_attribute *attr,
136+
const char *buf, size_t count)
138137
{
139138
char version[PPI_VERSION_LEN + 1];
140139
acpi_handle handle;
@@ -207,9 +206,9 @@ ssize_t tpm_store_ppi_request(struct device *dev,
207206
return status;
208207
}
209208

210-
ssize_t tpm_show_ppi_transition_action(struct device *dev,
211-
struct device_attribute *attr,
212-
char *buf)
209+
static ssize_t tpm_show_ppi_transition_action(struct device *dev,
210+
struct device_attribute *attr,
211+
char *buf)
213212
{
214213
char version[PPI_VERSION_LEN + 1];
215214
acpi_handle handle;
@@ -269,9 +268,9 @@ ssize_t tpm_show_ppi_transition_action(struct device *dev,
269268
return status;
270269
}
271270

272-
ssize_t tpm_show_ppi_response(struct device *dev,
273-
struct device_attribute *attr,
274-
char *buf)
271+
static ssize_t tpm_show_ppi_response(struct device *dev,
272+
struct device_attribute *attr,
273+
char *buf)
275274
{
276275
acpi_handle handle;
277276
acpi_status status;
@@ -413,14 +412,16 @@ static ssize_t show_ppi_operations(char *buf, u32 start, u32 end)
413412
return str - buf;
414413
}
415414

416-
ssize_t tpm_show_ppi_tcg_operations(struct device *dev,
417-
struct device_attribute *attr, char *buf)
415+
static ssize_t tpm_show_ppi_tcg_operations(struct device *dev,
416+
struct device_attribute *attr,
417+
char *buf)
418418
{
419419
return show_ppi_operations(buf, 0, PPI_TPM_REQ_MAX);
420420
}
421421

422-
ssize_t tpm_show_ppi_vs_operations(struct device *dev,
423-
struct device_attribute *attr, char *buf)
422+
static ssize_t tpm_show_ppi_vs_operations(struct device *dev,
423+
struct device_attribute *attr,
424+
char *buf)
424425
{
425426
return show_ppi_operations(buf, PPI_VS_REQ_START, PPI_VS_REQ_END);
426427
}

0 commit comments

Comments
 (0)