Message ID | 20140308113820.8885.96734.stgit@potku.adurom.net (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Kalle Valo <kvalo@qca.qualcomm.com> writes: > Jason noticed that with Yocto GCC 4.8.1 ath6kl crashes with this iperf command: > > iperf -c $TARGET_IP -i 5 -t 50 -w 1M > > The crash was: > [...] > ---[ end trace 0c038f0b8e0b67a3 ]--- > Kernel panic - not syncing: Fatal exception > > Jason's analysis: > > > "The GCC 4.8.1 compiler will not do the for-loop till scat_entries, instead, > it only run one round loop. This may be caused by that the GCC 4.8.1 thought > that the scat_list only have one item and then no need to do full iteration, > but this is simply wrong by looking at the assebly code. This will cause the sg > buffer not get set when scat_entries > 1 and thus lead to kernel panic. > > Note: This issue not observed with GCC 4.7.2, only found on the GCC 4.8.1)" > > Fix this by using the normal [0] style for defining unknown number of list > entries following the struct. This also fixes corruption with scat_q_depth, which > was mistankely added to the end of struct and overwritten if there were more > than item in the scat list. > > Reported-by: Jason Liu <r64343@freescale.com> > Tested-by: Jason Liu <r64343@freescale.com> > Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> Applied.
diff --git a/drivers/net/wireless/ath/ath6kl/hif.h b/drivers/net/wireless/ath/ath6kl/hif.h index 61f6b21fb0ae..dc6bd8cd9b83 100644 --- a/drivers/net/wireless/ath/ath6kl/hif.h +++ b/drivers/net/wireless/ath/ath6kl/hif.h @@ -197,9 +197,9 @@ struct hif_scatter_req { /* bounce buffer for upper layers to copy to/from */ u8 *virt_dma_buf; - struct hif_scatter_item scat_list[1]; - u32 scat_q_depth; + + struct hif_scatter_item scat_list[0]; }; struct ath6kl_irq_proc_registers { diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c index 7126bdd4236c..6bf15a331714 100644 --- a/drivers/net/wireless/ath/ath6kl/sdio.c +++ b/drivers/net/wireless/ath/ath6kl/sdio.c @@ -348,7 +348,7 @@ static int ath6kl_sdio_alloc_prep_scat_req(struct ath6kl_sdio *ar_sdio, int i, scat_req_sz, scat_list_sz, size; u8 *virt_buf; - scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item); + scat_list_sz = n_scat_entry * sizeof(struct hif_scatter_item); scat_req_sz = sizeof(*s_req) + scat_list_sz; if (!virt_scat)