arm: mvebu: avoid possible NULL dereference
Subsystems (3)
PATCH 1/1 arm: mvebu: avoid possible NULL dereference
It does not make sense to check if info is NULL after dereferencing it.
The problem was indicated by cppcheck.
Signed-off-by Heinrich Schuchardt <[email protected]>
--- arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c +5 -5
@@ -354,16 +354,16 @@ int serdes_phy_config(void) } info =board_serdes_cfg_get (PEX_MODE_GET (satr11)); -DEBUG_INIT_FULL_S ("info->line0_7= 0x" ); -DEBUG_INIT_FULL_D (info->line0_7,8 ); -DEBUG_INIT_FULL_S (" info->line8_15= 0x" ); -DEBUG_INIT_FULL_D (info->line8_15,8 ); -DEBUG_INIT_FULL_S ("\n" );if (info ==NULL ) {DEBUG_INIT_S ("Hight speed PHY Error #1\n" );return MV_ERROR ; } +DEBUG_INIT_FULL_S ("info->line0_7= 0x" ); +DEBUG_INIT_FULL_D (info->line0_7,8 ); +DEBUG_INIT_FULL_S (" info->line8_15= 0x" ); +DEBUG_INIT_FULL_D (info->line8_15,8 ); +DEBUG_INIT_FULL_S ("\n" );if (config_module &ETM_MODULE_DETECT ) {/* step 0.9 ETM */ DEBUG_INIT_FULL_S ("ETM module detect Step 0.9:\n" );
Signature · 1 line
2.13.2
PATCH 1/1 arm: mvebu: avoid possible NULL dereference
Quoted 27 lines · Heinrich Schuchardt
It does not make sense to check if info is NULL after dereferencing it.
The problem was indicated by cppcheck.
Signed-off-by Heinrich Schuchardt <[email protected]>--- arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c +0
-5@@ -354,16 +354,16 @@ int serdes_phy_config(void) } info =board_serdes_cfg_get (PEX_MODE_GET (satr11)); -DEBUG_INIT_FULL_S ("info->line0_7= 0x" ); -DEBUG_INIT_FULL_D (info->line0_7,8 ); -DEBUG_INIT_FULL_S (" info->line8_15= 0x" ); -DEBUG_INIT_FULL_D (info->line8_15,8 ); -DEBUG_INIT_FULL_S ("\n" );if (info ==NULL ) {DEBUG_INIT_S ("Hight speed PHY Error #1\n" );
arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c int serdes_phy_config(void) · line 369
Quoted 10 lines
arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c +5
-0return MV_ERROR ; } +DEBUG_INIT_FULL_S ("info->line0_7= 0x" ); +DEBUG_INIT_FULL_D (info->line0_7,8 ); +DEBUG_INIT_FULL_S (" info->line8_15= 0x" ); +DEBUG_INIT_FULL_D (info->line8_15,8 ); +DEBUG_INIT_FULL_S ("\n" );if (config_module &ETM_MODULE_DETECT ) {/* step 0.9 ETM */ DEBUG_INIT_FULL_S ("ETM module detect Step 0.9:\n" );
Reviewed-by Stefan Roese <[email protected]>
Thanks,
Stefan
PATCH 1/1 arm: mvebu: avoid possible NULL dereference
In reply to Heinrich SchuchardtQuoted 7 lines · xypron.glpk at gmx.de
It does not make sense to check if info is NULL after dereferencing it.
The problem was indicated by cppcheck.
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170813/786d2f75/attachment.sig>