mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
ufs: sector_t cannot be negative
unsigned i_block,fragment cannot be negative. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
5404ac8e44
commit
37044c86ba
@ -56,9 +56,7 @@ static int ufs_block_to_path(struct inode *inode, sector_t i_block, sector_t off
|
|||||||
|
|
||||||
|
|
||||||
UFSD("ptrs=uspi->s_apb = %d,double_blocks=%ld \n",ptrs,double_blocks);
|
UFSD("ptrs=uspi->s_apb = %d,double_blocks=%ld \n",ptrs,double_blocks);
|
||||||
if (i_block < 0) {
|
if (i_block < direct_blocks) {
|
||||||
ufs_warning(inode->i_sb, "ufs_block_to_path", "block < 0");
|
|
||||||
} else if (i_block < direct_blocks) {
|
|
||||||
offsets[n++] = i_block;
|
offsets[n++] = i_block;
|
||||||
} else if ((i_block -= direct_blocks) < indirect_blocks) {
|
} else if ((i_block -= direct_blocks) < indirect_blocks) {
|
||||||
offsets[n++] = UFS_IND_BLOCK;
|
offsets[n++] = UFS_IND_BLOCK;
|
||||||
@ -440,8 +438,6 @@ int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buffer_head
|
|||||||
lock_kernel();
|
lock_kernel();
|
||||||
|
|
||||||
UFSD("ENTER, ino %lu, fragment %llu\n", inode->i_ino, (unsigned long long)fragment);
|
UFSD("ENTER, ino %lu, fragment %llu\n", inode->i_ino, (unsigned long long)fragment);
|
||||||
if (fragment < 0)
|
|
||||||
goto abort_negative;
|
|
||||||
if (fragment >
|
if (fragment >
|
||||||
((UFS_NDADDR + uspi->s_apb + uspi->s_2apb + uspi->s_3apb)
|
((UFS_NDADDR + uspi->s_apb + uspi->s_2apb + uspi->s_3apb)
|
||||||
<< uspi->s_fpbshift))
|
<< uspi->s_fpbshift))
|
||||||
@ -504,10 +500,6 @@ abort:
|
|||||||
unlock_kernel();
|
unlock_kernel();
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
abort_negative:
|
|
||||||
ufs_warning(sb, "ufs_get_block", "block < 0");
|
|
||||||
goto abort;
|
|
||||||
|
|
||||||
abort_too_big:
|
abort_too_big:
|
||||||
ufs_warning(sb, "ufs_get_block", "block > big");
|
ufs_warning(sb, "ufs_get_block", "block > big");
|
||||||
goto abort;
|
goto abort;
|
||||||
|
Loading…
Reference in New Issue
Block a user