Source-Changes-D archive

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

Re: CVS commit: src/sys



In article <19990.1566969556%splode.eterna.com.au@localhost>,
matthew green  <mrg%eterna.com.au@localhost> wrote:
>> 	src/sys/kern: vfs_bio.c
>> 	src/sys/sys: buf.h
>> 
>> Log Message:
>>  Change buf_nbuf()'s return value from int to u_int to avoid undefined
>> behavior in wapbl_start() which extended int to size_t.
>> 
>> Error message was:
>> > UBSan: Undefined Behavior in ../../../../kern/vfs_wapbl.c:609:41,
>signed integer overflow: 3345138 * 1024 cannot be represented in type
>'int'
>> 
>> >        /* XXX maybe use filesystem fragment size instead of 1024 */
>> >         /* XXX fix actual number of buffers reserved per filesystem. */
>> >         wl->wl_bufcount_max = (buf_nbuf() / 2) * 1024;
>> 
>> Need more work?
>
>i would have made buf_nbuf() return size_t.

Or u_int which is what nbuf is...

christos



Home | Main Index | Thread Index | Old Index