On Fri, May 20, 2016 at 4:02 PM, Bruce Evans <b...@optusnet.com.au> wrote:
> On Fri, 20 May 2016, Konstantin Belousov wrote:
>
>> --- head/sys/i386/i386/sys_machdep.c    Fri May 20 19:46:25 2016
>> (r300331)
>> +++ head/sys/i386/i386/sys_machdep.c    Fri May 20 19:50:32 2016
>> (r300332)
>> @@ -315,8 +315,9 @@ i386_set_ioperm(td, uap)
>>         struct thread *td;
>>         struct i386_ioperm_args *uap;
>> {
>> -       int i, error;
>>         char *iomap;
>> +       u_int i;
>> +       int error;
>>
>>         if ((error = priv_check(td, PRIV_IO)) != 0)
>>                 return (error);
>> @@ -334,7 +335,8 @@ i386_set_ioperm(td, uap)
>>                         return (error);
>>         iomap = (char *)td->td_pcb->pcb_ext->ext_iomap;
>>
>> -       if (uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
>> +       if (uap->start > uap->start + uap->length ||
>> +           uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
>>                 return (EINVAL);
>>
>>         for (i = uap->start; i < uap->start + uap->length; i++) {
>
>
> I don't like using u_int for a small index.

Why not?  Indices are by definition non-negative so the fit seems natural.

>  After the bounds checking
> fix, the range fits in a small signed integer.  However, uap->start
> and uap->length already use bad type u_int, so it is natural to keep
> using that type.

What's bad about it?

Thanks,
Conrad
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to