aboutsummaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorChris Kay <chris.kay@arm.com>2018-06-14 11:27:17 +0100
committerronald-cron-arm <39518861+ronald-cron-arm@users.noreply.github.com>2018-09-17 11:30:58 +0100
commiteff37bd0548b96daf29ae02483dd8fc186ceefff (patch)
treeab1af60c68323a7c55e518a923df8d646decfc25 /module
parente730d9b60dae0813d62dd07f2d9b248e4ba68ef3 (diff)
misc: Fix possible use-before-initialization errors
All of these issues stem from assuming that passing a pointer-to-mutable will initialize the object if it's not already initialized, but it's unsafe to assume this is the case even if it is judged that the call returned successfully, as the implementation may change at any point. Change-Id: Ica114514429005b18d04efce2529e0a64a182525 Signed-off-by: Chris Kay <chris.kay@arm.com>
Diffstat (limited to 'module')
-rw-r--r--module/log/src/mod_log.c2
-rw-r--r--module/power_domain/src/mod_power_domain.c2
-rw-r--r--module/scmi/src/mod_scmi.c4
-rw-r--r--module/sensor/src/mod_sensor.c2
-rw-r--r--module/timer/src/mod_timer.c2
5 files changed, 6 insertions, 6 deletions
diff --git a/module/log/src/mod_log.c b/module/log/src/mod_log.c
index c6431282..57724890 100644
--- a/module/log/src/mod_log.c
+++ b/module/log/src/mod_log.c
@@ -327,7 +327,7 @@ static int log_init(fwk_id_t module_id, unsigned int element_count,
static int log_bind(fwk_id_t id, unsigned int round)
{
int status;
- struct mod_log_driver_api *driver;
+ struct mod_log_driver_api *driver = NULL;
/* Skip second round */
if (round == 1)
diff --git a/module/power_domain/src/mod_power_domain.c b/module/power_domain/src/mod_power_domain.c
index 47853e3d..185a9e90 100644
--- a/module/power_domain/src/mod_power_domain.c
+++ b/module/power_domain/src/mod_power_domain.c
@@ -1714,7 +1714,7 @@ static int pd_bind(fwk_id_t id, unsigned int round)
int status;
struct pd_ctx *pd;
const struct mod_power_domain_element_config *config;
- struct mod_pd_driver_api *driver_api;
+ struct mod_pd_driver_api *driver_api = NULL;
/* Nothing to do but during the first round of calls */
if (round != 0)
diff --git a/module/scmi/src/mod_scmi.c b/module/scmi/src/mod_scmi.c
index ab1e18a1..d036cb92 100644
--- a/module/scmi/src/mod_scmi.c
+++ b/module/scmi/src/mod_scmi.c
@@ -620,10 +620,10 @@ static int scmi_bind(fwk_id_t id, unsigned int round)
{
int status;
struct scmi_service_ctx *ctx;
- const struct mod_scmi_to_transport_api *transport_api;
+ const struct mod_scmi_to_transport_api *transport_api = NULL;
unsigned int protocol_idx;
struct scmi_protocol *protocol;
- struct mod_scmi_to_protocol_api *protocol_api;
+ struct mod_scmi_to_protocol_api *protocol_api = NULL;
uint8_t scmi_protocol_id;
if (round == 0) {
diff --git a/module/sensor/src/mod_sensor.c b/module/sensor/src/mod_sensor.c
index 62584a78..e301a4fd 100644
--- a/module/sensor/src/mod_sensor.c
+++ b/module/sensor/src/mod_sensor.c
@@ -128,7 +128,7 @@ static int sensor_bind(fwk_id_t id, unsigned int round)
{
struct sensor_dev_ctx *ctx;
int status;
- struct mod_sensor_driver_api *driver;
+ struct mod_sensor_driver_api *driver = NULL;
if ((round > 0) || fwk_id_is_type(id, FWK_ID_TYPE_MODULE)) {
/*
diff --git a/module/timer/src/mod_timer.c b/module/timer/src/mod_timer.c
index 51789d92..a4183276 100644
--- a/module/timer/src/mod_timer.c
+++ b/module/timer/src/mod_timer.c
@@ -559,7 +559,7 @@ static int timer_bind(fwk_id_t id, unsigned int round)
{
int status;
struct dev_ctx *ctx;
- struct mod_timer_driver_api *driver;
+ struct mod_timer_driver_api *driver = NULL;
unsigned int driver_module_idx;
/* Nothing to do after the initial round. */