diff options
author | Ronak Kanabar <ronak.kanabar@intel.com> | 2020-11-30 15:40:51 +0530 |
---|---|---|
committer | Subrata Banik <subrata.banik@intel.com> | 2020-12-02 06:07:05 +0000 |
commit | 7c0f007cf589ac01e35d555d0c8d98f4a72396d4 (patch) | |
tree | d5d4e9cbb9f1243dddf7fa87e40671c5faf0ac68 /src/acpi/acpigen.c | |
parent | ab0d85c9875dc83f8aee37bcb18eb834cfb2a238 (diff) |
src/acpi/acpigen: Add NULL pointer check
Add NULL pointer check in acpigen_emit_namestring
to avoid segmentation fault.
Change-Id: I3d01d28e74f202278b5a5a96d2edd45c66f10883
Signed-off-by: Ronak Kanabar <ronak.kanabar@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48148
Reviewed-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-by: Maulik V Vaghela <maulik.v.vaghela@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/acpi/acpigen.c')
-rw-r--r-- | src/acpi/acpigen.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c index 244ac548c9..9a5543d5a4 100644 --- a/src/acpi/acpigen.c +++ b/src/acpi/acpigen.c @@ -291,6 +291,10 @@ void acpigen_emit_namestring(const char *namepath) int dotcount = 0, i; int dotpos = 0; + /* Check for NULL pointer */ + if (!namepath) + return; + /* We can start with a '\'. */ if (namepath[0] == '\\') { acpigen_emit_byte('\\'); |