mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-04 19:17:34 +00:00
misc: fix the secure coding style violations of tpm
There is an secure coding style violations of tmp, this patch add some NULL check to fix these violations. Tracked-On: #6690 Signed-off-by: Chenli Wei <chenli.wei@linux.intel.com>
This commit is contained in:
parent
31b9312f2f
commit
6a3807748c
@ -115,11 +115,11 @@ int create_pt_acpidev(char *opt)
|
||||
*
|
||||
* @pre (name != NULL) && (strlen(name) > 0)
|
||||
*/
|
||||
int get_mmio_hpa_resource(char *name, uint64_t *res_start, uint64_t *res_size)
|
||||
bool get_mmio_hpa_resource(char *name, uint64_t *res_start, uint64_t *res_size)
|
||||
{
|
||||
FILE *fp;
|
||||
uint64_t start, end;
|
||||
int found = false;
|
||||
bool found = false;
|
||||
char line[128];
|
||||
char *cp;
|
||||
|
||||
|
@ -119,9 +119,10 @@ static int init_tpm2_pt(char *opts, struct mmio_dev *tpm2dev)
|
||||
}
|
||||
|
||||
devopts = strdup(opts);
|
||||
if (devopts != NULL) {
|
||||
vtopts = strstr(devopts,",");
|
||||
if (devopts == NULL) {
|
||||
return -ENODEV;
|
||||
}
|
||||
vtopts = strstr(devopts,",");
|
||||
|
||||
/* Check whether user set the uid to identify same hid devices for
|
||||
* several instances.
|
||||
@ -131,7 +132,7 @@ static int init_tpm2_pt(char *opts, struct mmio_dev *tpm2dev)
|
||||
}
|
||||
|
||||
/* parse /proc/iomem to find the address and size of tpm buffer */
|
||||
if ((devopts != NULL) && (!get_mmio_hpa_resource(devopts, &tpm2_buffer_hpa, &tpm2_buffer_size))) {
|
||||
if (!get_mmio_hpa_resource(devopts, &tpm2_buffer_hpa, &tpm2_buffer_size)) {
|
||||
free(devopts);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ struct acpi_dev_pt_ops {
|
||||
#define DEFINE_ACPI_PT_DEV(x) DATA_SET(acpi_dev_pt_ops_set, x);
|
||||
|
||||
struct mmio_dev *get_mmiodev(char *name);
|
||||
int get_mmio_hpa_resource(char *name, uint64_t *res_start, uint64_t *res_size);
|
||||
bool get_mmio_hpa_resource(char *name, uint64_t *res_start, uint64_t *res_size);
|
||||
int get_more_acpi_dev_info(char *hid, uint32_t instance, struct acpi_dev_pt_ops *ops);
|
||||
void acpi_dev_write_dsdt(struct vmctx *ctx);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user