Source-Changes archive

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

Re: CVS commit: syssrc/sys/kern



>> Modified Files:
>>         syssrc/sys/kern: kern_resource.c
>>
>> Log Message:
>> check negative arg.  from openbsd
>Due to the `(u_int)' cast -- which I added just about 5 years ago --
>this code already handled negative arguments correctly.  Your change
>is a noop.

        ok, but isn't it better to explicitly check
                if (which < 0 || which >= MAX)
                        return EINVAL
        than
                if ((u_int)which >= MAX)
                        return EINVAL
        from readability/clarity?

itojun



Home | Main Index | Thread Index | Old Index