master: sys/dev/sound/pcm/vchan.c cb8ff21ad49e7a92c572b31c6e26ad74d0feed5f

YONETANI Tomokazu qhwt+dfly at les.ath.cx
Tue Dec 2 21:17:48 PST 2008


On Wed, Dec 03, 2008 at 03:55:37AM +0100, Simon 'corecode' Schubert wrote:
> YONETANI Tomokazu wrote:
>> On Mon, Dec 01, 2008 at 03:59:30PM -0800, Simon Schubert wrote:
>>> http://gitweb.dragonflybsd.org/?p=dragonfly.git;a=commitdiff;h=cb8ff21ad49e7a92c572b31c6e26ad74d0feed5f
>>
>>   -       scale = (volume << 16) / 100;
>>   +       scale = log_mix_cvt[volume];
>>
>> I don't see how it's guaranteed that (volume < countof(log_mix_cvt) - 1).
>> The comment above that says `volume is in range 0-100', which is only
>> satisfied when (ch->volume & 0xff) + ((ch->volume >> 8) & 0xff) <= 200,
>> but I see no such check in the code under /sys/dev/sound...
>
> I believe that the mixer ioctls check for overflow.  Otherwise this is a bug.

Aha, I overlooked the check in chn_setvolume(), and there's no other
places where ch->volume is directly modified, so I believe that
the comment is correct.  Sorry about the noise.





More information about the Commits mailing list