DM: avoid NULL pointer dereferenced in 'ioc_parse()'

Pointer 'tmp' may be NULL before passing it to 'strtoul()'

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Yonghua Huang 2018-05-22 19:23:52 +08:00 committed by lijinxia
parent 7a09c81b10
commit f58fe33687
1 changed files with 2 additions and 1 deletions

View File

@ -1043,7 +1043,8 @@ ioc_parse(const char *opts)
snprintf(virtual_uart_path, sizeof(virtual_uart_path), "%s", param);
if (tmp != NULL) {
tmp = strtok(NULL, ",");
ioc_boot_reason = strtoul(tmp, 0, 0);
if (tmp != NULL)
ioc_boot_reason = strtoul(tmp, 0, 0);
}
free(param);
return 0;