Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: 2cff8743ced9c2f79014a19077e91537fb938bb8
      
https://github.com/tianocore/edk2/commit/2cff8743ced9c2f79014a19077e91537fb938bb8
  Author: PaddyDeng <v-paddyd...@microsoft.com>
  Date:   2025-05-05 (Mon, 05 May 2025)

  Changed paths:
    M MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlash.c

  Log Message:
  -----------
  MdeModulePkg/Spi: Solving potential null ptr deref. in SpiNorFlashJedecSfdp

The pointer `Instance->SfdpBasicFlash` can be used before initializing.

Example code flow:
- CreateSpiNorFlashSfdpInstance: Allocate pool for `Instance`
    - InitialSpiNorFlashSfdpInstance
        - ReadSfdp
            - ReadSfdpHeader
                - FillWriteBuffer: Dereferencing
`Instance->SfdpBasicFlash`
            - ReadSfdpBasicParameterTable: Allocate pool for
`Instance->SfdpBasicFlash`

Check both `Instance` and `Instance->SfdpBasicFlash` should have
a non null value before dereferencing it. Otherwise use the defaut
value 0.

Also terminate the function if `Instance` or `WriteBuffer` is NULL.

Signed-off-by: Paddy Deng <v-paddyd...@microsoft.com>



To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to