I can see the reason why this seg faults...

ani_state = kzalloc(sizeof(struct ath5k_ani_state), GFP_KERNEL);

shoud be

*ani_state = kzalloc(sizeof(struct ath5k_ani_state), GFP_KERNEL);



On Wed, 2008-09-24 at 08:49 -0400, Bob Copeland wrote:
> > b) During attach i do a bad memory allocation
> > ani_stats = kzalloc(sizeof(struct ath5k_ani_state), GFP_KERNEL);
> > just change it to
> > ani_stats = kzalloc(sizeof(struct ath5k_ani_stats), GFP_KERNEL);
> 
> Looks like more is wrong with that:
> 
> > int ath5k_hw_ani_attach(struct ath5k_hw *ah){
> >     struct ath5k_ani_state *ani_state = ah->ah_ani_state;
> >     struct ath5k_ani_stats *ani_stats = ah->ah_ani_stats;
> >     struct ath5k_softc *sc = ah->ah_sc;
> >
> >     /* Allocate needed structs */
> >     ani_state = kzalloc(sizeof(struct ath5k_ani_state), GFP_KERNEL);
> >     [...]
> >     ath5k_hw_ani_set_min_immunity(ah);
> 
> Shouldn't this be something like:
> 
>       ah->ah_ai_state = kzalloc()...
> 
> Otherwise ath5k_hw_ani_set_min_immunity segfaults immediately.  Also
> there's a memleak there if the first kzalloc works but the second fails :)
> 
> Otherwise, thanks for posting the code!  I hope to digest it over the
> next day or two...
> 

_______________________________________________
ath5k-devel mailing list
ath5k-devel@lists.ath5k.org
https://lists.ath5k.org/mailman/listinfo/ath5k-devel

Reply via email to