Joel Sherrill commented on a discussion on 
cpukit/libfs/src/rfs/rtems-rfs-bitmaps.c: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/892#note_138139

 >    if (rc > 0)
 >      return rc;
 >  
 > -  if (bit >= control->size)
 > +  if (bit < 0 || (size_t)bit >= control->size)

I have added comments above where I removed checks on unsigned types being < 0. 
It is natural to write 0 <= value <= MAX. If there is not a check in the code, 
it is easy to think there should be one there and you end up going down a 
rabbit hole. 

And yes, at least @chris and I have been on RTEMS long enough to not even 
remember if we wrote something specific -- much less remember some odd detail. 
Comments last longer and have a wider audience than memory.

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/892#note_138139
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to