Refine code to make it more safely.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@arm.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2-fatdriver2/code/trunk/FatPkg@85 efd2e655-3735-4b16-a529-16bfa2dd702b