File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -692,6 +692,8 @@ static unsigned long bdi_ratio_from_pages(unsigned long pages)
692
692
unsigned long ratio ;
693
693
694
694
global_dirty_limits (& background_thresh , & dirty_thresh );
695
+ if (!dirty_thresh )
696
+ return - EINVAL ;
695
697
ratio = div64_u64 (pages * 100ULL * BDI_RATIO_SCALE , dirty_thresh );
696
698
697
699
return ratio ;
@@ -790,13 +792,15 @@ int bdi_set_min_bytes(struct backing_dev_info *bdi, u64 min_bytes)
790
792
{
791
793
int ret ;
792
794
unsigned long pages = min_bytes >> PAGE_SHIFT ;
793
- unsigned long min_ratio ;
795
+ long min_ratio ;
794
796
795
797
ret = bdi_check_pages_limit (pages );
796
798
if (ret )
797
799
return ret ;
798
800
799
801
min_ratio = bdi_ratio_from_pages (pages );
802
+ if (min_ratio < 0 )
803
+ return min_ratio ;
800
804
return __bdi_set_min_ratio (bdi , min_ratio );
801
805
}
802
806
@@ -809,13 +813,15 @@ int bdi_set_max_bytes(struct backing_dev_info *bdi, u64 max_bytes)
809
813
{
810
814
int ret ;
811
815
unsigned long pages = max_bytes >> PAGE_SHIFT ;
812
- unsigned long max_ratio ;
816
+ long max_ratio ;
813
817
814
818
ret = bdi_check_pages_limit (pages );
815
819
if (ret )
816
820
return ret ;
817
821
818
822
max_ratio = bdi_ratio_from_pages (pages );
823
+ if (max_ratio < 0 )
824
+ return max_ratio ;
819
825
return __bdi_set_max_ratio (bdi , max_ratio );
820
826
}
821
827
You can’t perform that action at this time.
0 commit comments