This commit adds ASSERTs to address false positive reports of NULL
pointer dereference issues raised from static analysis with regard to
function ReadDirectoryEntry().
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Reviewed-by: Star Zeng <star.zeng@intel.com>
\r
goto Done;\r
}\r
+ //\r
+ // After calling function ReadDirectoryEntry(), if 'NewFileIdentifierDesc'\r
+ // is NULL, then the 'Status' must be EFI_OUT_OF_RESOURCES. Hence, if the\r
+ // code reaches here, 'NewFileIdentifierDesc' must be not NULL.\r
+ //\r
+ // The ASSERT here is for addressing a false positive NULL pointer\r
+ // dereference issue raised from static analysis.\r
+ //\r
+ ASSERT (NewFileIdentifierDesc != NULL);\r
\r
if (!IS_FID_PARENT_FILE (NewFileIdentifierDesc)) {\r
break;\r
\r
break;\r
}\r
+ //\r
+ // After calling function ReadDirectoryEntry(), if 'FileIdentifierDesc' is\r
+ // NULL, then the 'Status' must be EFI_OUT_OF_RESOURCES. Hence, if the code\r
+ // reaches here, 'FileIdentifierDesc' must be not NULL.\r
+ //\r
+ // The ASSERT here is for addressing a false positive NULL pointer\r
+ // dereference issue raised from static analysis.\r
+ //\r
+ ASSERT (FileIdentifierDesc != NULL);\r
\r
if (FileIdentifierDesc->FileCharacteristics & PARENT_FILE) {\r
//\r