buglet in swapon with very large files

Denys Vlasenko vda.linux at googlemail.com
Mon Nov 5 11:27:41 PST 2007


On Monday 05 November 2007 16:54, Paul Fox wrote:
> hi --
> 
> one of our team found this while experimenting with a very large
> swap file.  the symptom is that the file is rejected as having
> holes, when it does not (because the size goes negative).  he did
> this some time ago, and i haven't tried to reproduce it since,
> but the fix looks correct, and moreover, benign.
> 
> i'll commit in a day or two if there are no objections.

>  	if (S_ISREG(st.st_mode))
> -		if (st.st_blocks * 512 < st.st_size)
> +		if (st.st_blocks * 512u < st.st_size)
>  			bb_error_msg("warning: swap file has holes");

I am committing a change where 512 is casted to off_t.
--
vda


More information about the busybox mailing list