In vn_getsize_locked(), when storing vattr.va_size of type u_quad_t into off_t size, we must avoid overflow. Then, the check for fsize < 0, introduced in the commit f45feecfb27ca51067d6789eaa43547cadc4990b 'vfs: add vn_getsize', is nop [1]. Reported by: jhb Coverity CID: 1502346
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
sys/kern/vfs_subr.c | ||
---|---|---|
7133 | Is this something we can assert should never happen? |
sys/kern/vfs_subr.c | ||
---|---|---|
7133 | Sane filesystem would not do that indeed, but we did not required this before, and allowed full u_quad_t. My concern with adding the assert is that it would be hard to reach, esp. in non-targeted testing, so the assert would be a ticking bomb. I prefer to have the check and error return, due to this. |