ath6kl: Fix ath6kl_bmi_read_hi32 macro
PATCH 1/1 ath6kl: Fix ath6kl_bmi_read_hi32 macro
tmp may be used uninitialized if ath6kl_bmi_read() returns an error.
--- drivers/net/wireless/ath/ath6kl/bmi.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/bmi.h +2 -1
@@ -242,7 +242,8 @@ struct ath6kl_bmi_target_info { (void ) (check_type == val); \ addr =ath6kl_get_hi_item_addr (ar,HI_ITEM (item)); \ ret =ath6kl_bmi_read (ar, addr, (u8 *) &tmp,4 ); \ - *val =le32_to_cpu (tmp); \ +if (!ret) \ + *val =le32_to_cpu (tmp); \ ret; \ })
Signature · 1 line
1.7.9.5
Quoted 12 lines · Frederic Danis
tmp may be used uninitialized if
ath6kl_bmi_read()returns an error.Signed-off-by Frederic Danis <[email protected]>--- drivers/net/wireless/ath/ath6kl/bmi.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/wireless/ath/ath6kl/bmi.h +0
-0
drivers/net/wireless/ath/ath6kl/bmi.h struct ath6kl_bmi_target_info { · line 248
Quoted 8 lines
drivers/net/wireless/ath/ath6kl/bmi.h +2
-1@@ -242,7 +242,8 @@ struct ath6kl_bmi_target_info { (void ) (check_type == val); \ addr =ath6kl_get_hi_item_addr (ar,HI_ITEM (item)); \ ret =ath6kl_bmi_read (ar, addr, (u8 *) &tmp,4 ); \ - *val =le32_to_cpu (tmp); \ +if (!ret) \ + *val =le32_to_cpu (tmp); \ ret; \ })
I see new warnings with this patch:
drivers/net/wireless/ath/ath6kl/init.c: In function '__ath6kl_init_hw_start.part.5':drivers/net/wireless/ath/ath6kl/init.c:1196:13: warning: 'board_ext_address' may be used uninitialized in this function [-Wuninitialized] drivers/net/wireless/ath/ath6kl/init.c:1147:21: note: 'board_ext_address' was declared here drivers/net/wireless/ath/ath6kl/init.c:1224:6: warning: 'board_address' may be used uninitialized in this function [-Wuninitialized] drivers/net/wireless/ath/ath6kl/init.c:1147:6: note: 'board_address' was declared here
Signature · 1 line
Kalle Valo
PATCH v2 1/1 ath6kl: Fix ath6kl_bmi_read_hi32 macro
tmp may be used uninitialized if ath6kl_bmi_read() returns an error.
--- drivers/net/wireless/ath/ath6kl/bmi.h | 3 ++- drivers/net/wireless/ath/ath6kl/init.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath6kl/bmi.h +2 -1
@@ -242,7 +242,8 @@ struct ath6kl_bmi_target_info { (void ) (check_type == val); \ addr =ath6kl_get_hi_item_addr (ar,HI_ITEM (item)); \ ret =ath6kl_bmi_read (ar, addr, (u8 *) &tmp,4 ); \ - *val =le32_to_cpu (tmp); \ +if (!ret) \ + *val =le32_to_cpu (tmp); \ ret; \ })
drivers/net/wireless/ath/ath6kl/init.c +10 -2
@@ -1161,11 +1161,19 @@ static int ath6kl_upload_board_file(struct ath6kl *ar)ath6kl_bmi_write_hi32 (ar, hi_board_data, board_address); }else { -ath6kl_bmi_read_hi32 (ar, hi_board_data, &board_address); + ret =ath6kl_bmi_read_hi32 (ar, hi_board_data, &board_address); +if (ret) { +ath6kl_err ("Failed to get board file target address.\n" ); +return ret; + } }/* determine where in target ram to write extended board data */ -ath6kl_bmi_read_hi32 (ar, hi_board_ext_data, &board_ext_address); + ret =ath6kl_bmi_read_hi32 (ar, hi_board_ext_data, &board_ext_address); +if (ret) { +ath6kl_err ("Failed to get extended board file target address.\n" ); +return ret; + }if (ar->target_type ==TARGET_TYPE_AR6003 && board_ext_address ==0 ) {
Signature · 1 line
1.7.9.5
Kalle Valo
AppliedQuoted 3 lines · Frederic Danis
tmp may be used uninitialized if
ath6kl_bmi_read()returns an error.Signed-off-by Frederic Danis <[email protected]>
Thanks, applied.
Signature · 1 line
Kalle Valo