tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Where's f_audioctx set?



>> However, the KASSERT, combined with AUDIO_SETINFO doing something,
>> indicates that it clearly is getting set.  So, I'm obviously missing
>> something.

>> What?

> I had need to look into the audio code some time back, so I think I
> can explain this:

> audio_open() in audio.c:

> 1. fills audio_file_t *af;
> 2. calls fd_allocfile(&fp, &fd);
> 3. does fd_clone() with `af' as last param;
> 4. fd_clone() does fp->f_data = af;
> 5. f_data is just f_undata.fd_data

> And, since f_undata is a union, step 4 sets fd_audioctx.

Oh, ick.  (This causes all fields of f_undata other than fd_data, or,
possibly, other void * fields - I'd have to think about that - to go
undefined, as in accessing them produces undefined behaviour.  I'm
slightly surprised undefined-behaviour detectors haven't been kicking
up a fuss.)

Thank you for explaining!

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index