vm_ooffset_t is now unsigned
vm_ooffset_t is now unsigned. Remove some tests for negative values, or make other adjustments accordingly. Reported by: Coverity Reviewed by: kib markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D26214
This commit is contained in:
parent
6dadc5d1cd
commit
f9cc8410e1
@ -176,7 +176,7 @@ fb_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot,
|
||||
if (info->fb_flags & FB_FLAG_NOMMAP)
|
||||
return (ENODEV);
|
||||
|
||||
if (offset >= 0 && offset < info->fb_size) {
|
||||
if (offset < info->fb_size) {
|
||||
if (info->fb_pbase == 0)
|
||||
*paddr = vtophys((uint8_t *)info->fb_vbase + offset);
|
||||
else
|
||||
|
@ -484,7 +484,7 @@ ksyms_mmap_single(struct cdev *dev, vm_ooffset_t *offset, vm_size_t size,
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
if (*offset < 0 || *offset >= round_page(sc->sc_objsz) ||
|
||||
if (*offset >= round_page(sc->sc_objsz) ||
|
||||
size > round_page(sc->sc_objsz) - *offset ||
|
||||
(nprot & ~PROT_READ) != 0)
|
||||
return (EINVAL);
|
||||
|
@ -140,7 +140,7 @@ vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, vm_paddr_t *paddr,
|
||||
if (info->fb_flags & FB_FLAG_NOMMAP)
|
||||
return (ENODEV);
|
||||
|
||||
if (offset >= 0 && offset < info->fb_size) {
|
||||
if (offset < info->fb_size) {
|
||||
if (info->fb_pbase == 0) {
|
||||
*paddr = vtophys((uint8_t *)info->fb_vbase + offset);
|
||||
} else {
|
||||
|
@ -178,12 +178,14 @@ RB_PROTOTYPE_STATIC(tmpfs_dir, tmpfs_dirent, uh.td_entries, tmpfs_dirtree_cmp);
|
||||
size_t
|
||||
tmpfs_mem_avail(void)
|
||||
{
|
||||
vm_ooffset_t avail;
|
||||
size_t avail;
|
||||
long reserved;
|
||||
|
||||
avail = swap_pager_avail + vm_free_count() - tmpfs_pages_reserved;
|
||||
if (__predict_false(avail < 0))
|
||||
avail = 0;
|
||||
return (avail);
|
||||
avail = swap_pager_avail + vm_free_count();
|
||||
reserved = atomic_load_long(&tmpfs_pages_reserved);
|
||||
if (__predict_false(avail < reserved))
|
||||
return (0);
|
||||
return (avail - reserved);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
@ -1577,7 +1577,7 @@ shm_mmap(struct file *fp, vm_map_t map, vm_offset_t *addr, vm_size_t objsize,
|
||||
#ifdef _LP64
|
||||
objsize > OFF_MAX ||
|
||||
#endif
|
||||
foff < 0 || foff > OFF_MAX - objsize) {
|
||||
foff > OFF_MAX - objsize) {
|
||||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
@ -2630,7 +2630,7 @@ vn_mmap(struct file *fp, vm_map_t map, vm_offset_t *addr, vm_size_t size,
|
||||
#ifdef _LP64
|
||||
size > OFF_MAX ||
|
||||
#endif
|
||||
foff < 0 || foff > OFF_MAX - size)
|
||||
foff > OFF_MAX - size)
|
||||
return (EINVAL);
|
||||
|
||||
writecounted = FALSE;
|
||||
|
@ -541,9 +541,6 @@ vnode_pager_addr(struct vnode *vp, vm_ooffset_t address, daddr_t *rtaddress,
|
||||
daddr_t vblock;
|
||||
daddr_t voffset;
|
||||
|
||||
if (address < 0)
|
||||
return -1;
|
||||
|
||||
if (VN_IS_DOOMED(vp))
|
||||
return -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user