Commit 9a35bc2
hostap: avoid uninitialized variable use in hfa384x_get_rid
commit 48dc5fb3ba53b20418de8514700f63d88c5de3a3 upstream.
The driver reads a value from hfa384x_from_bap(), which may fail,
and then assigns the value to a local variable. gcc detects that
in in the failure case, the 'rlen' variable now contains
uninitialized data:
In file included from ../drivers/net/wireless/intersil/hostap/hostap_pci.c:220:0:
drivers/net/wireless/intersil/hostap/hostap_hw.c: In function 'hfa384x_get_rid':
drivers/net/wireless/intersil/hostap/hostap_hw.c:842:5: warning: 'rec' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (le16_to_cpu(rec.len) == 0) {
This restructures the function as suggested by Russell King, to
make it more readable and get more reliable error handling, by
handling each failure mode using a goto.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 58f80cc commit 9a35bc2
1 file changed
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
839 | | - | |
840 | | - | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
841 | 845 | | |
842 | 846 | | |
843 | 847 | | |
844 | 848 | | |
| 849 | + | |
845 | 850 | | |
846 | 851 | | |
847 | 852 | | |
848 | | - | |
| 853 | + | |
849 | 854 | | |
850 | 855 | | |
851 | 856 | | |
852 | 857 | | |
853 | 858 | | |
854 | 859 | | |
855 | | - | |
856 | | - | |
| 860 | + | |
857 | 861 | | |
| 862 | + | |
858 | 863 | | |
859 | 864 | | |
860 | 865 | | |
| |||
0 commit comments