diff options
author | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2017-06-14 11:38:56 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-06-19 14:49:29 +1000 |
commit | 5e55f0b5e0791eae54da39dfeff38f57a3dcbfa4 (patch) | |
tree | 5ba8892cf43ae98a4270a54aaea7e813b0a7e49c | |
parent | cbfdc385ec93be8741f2af13cee03fac2dc1d236 (diff) | |
download | skiboot-5e55f0b5e0791eae54da39dfeff38f57a3dcbfa4.zip skiboot-5e55f0b5e0791eae54da39dfeff38f57a3dcbfa4.tar.gz skiboot-5e55f0b5e0791eae54da39dfeff38f57a3dcbfa4.tar.bz2 |
FSP/CONSOLE: Fix possible NULL dereference
Fix coverity warning message.
Null pointer dereferences (NULL_RETURNS)
/hw/fsp/fsp-console.c: 295 in fsp_open_vserial()
289
290 fs->open = true;
291
292 fs->poke_msg = fsp_mkmsg(FSP_CMD_VSERIAL_OUT, 2,
293 msg->data.words[0],
294 msg->data.words[1] & 0xffff);
>>> CID 145796: Null pointer dereferences (NULL_RETURNS)
>>> Dereferencing a null pointer "fs->poke_msg".
295 fs->poke_msg->user_data = fs;
296
297 fs->in_buf->partition_id = fs->out_buf->partition_id = part_id;
298 fs->in_buf->session_id = fs->out_buf->session_id = sess_id;
299 fs->in_buf->hmc_id = fs->out_buf->hmc_id = hmc_indx;
300 fs->in_buf->data_offset = fs->out_buf->data_offset =
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | hw/fsp/fsp-console.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c index ae71761..49e709b 100644 --- a/hw/fsp/fsp-console.c +++ b/hw/fsp/fsp-console.c @@ -292,11 +292,16 @@ static void fsp_open_vserial(struct fsp_msg *msg) goto already_open; } - fs->open = true; - fs->poke_msg = fsp_mkmsg(FSP_CMD_VSERIAL_OUT, 2, msg->data.words[0], msg->data.words[1] & 0xffff); + if (fs->poke_msg == NULL) { + prerror("FSPCON: Failed to allocate poke_msg\n"); + unlock(&fsp_con_lock); + return; + } + + fs->open = true; fs->poke_msg->user_data = fs; fs->in_buf->partition_id = fs->out_buf->partition_id = part_id; |