Message ID | 20250512144921.27555-2-ivan.hu@canonical.com |
---|---|
State | Accepted |
Headers | show |
diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c index 4b0dc4bf..5daea009 100644 --- a/src/opal/reserv_mem.c +++ b/src/opal/reserv_mem.c @@ -72,6 +72,11 @@ static int get_config(fwts_framework *fw, uint64_t value; cfline = strstr((char *)line, DELIM); + if (!cfline) { + fwts_log_warning(fw, "Unexpected line format: %s", line); + continue; + } + cfline = cfline + strlen(DELIM); value = strtoul(cfline, &p, 16);
https://bugs.launchpad.net/fwts/+bug/2109461 Got the complain for coverity scan for the strstr return Null, CID 520694: (#1 of 1): Dereference null return value (NULL_RETURNS) 10. dereference: Dereferencing a pointer that might be NULL cfline when calling strtoul Add checking the warnings for the unexpected line format. Signed-off-by: Ivan Hu <ivan.hu@canonical.com> --- src/opal/reserv_mem.c | 5 +++++ 1 file changed, 5 insertions(+)