swaponoff: prevent arithmetic overflow (spotted by Paul Fox <pgf@brightstareng.com>)
authorDenis Vlasenko <vda.linux@googlemail.com>
Mon, 5 Nov 2007 19:33:38 +0000 (19:33 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Mon, 5 Nov 2007 19:33:38 +0000 (19:33 -0000)
util-linux/swaponoff.c

index 6858d2619c784d849bf77e940ff194681faae063..48f6f4e0bf979438ca7b9bd5d3cfbc2feeb18eaf 100644 (file)
@@ -21,7 +21,7 @@ static int swap_enable_disable(char *device)
 #if ENABLE_DESKTOP
        /* test for holes */
        if (S_ISREG(st.st_mode))
-               if (st.st_blocks * 512 < st.st_size)
+               if (st.st_blocks * (off_t)512 < st.st_size)
                        bb_error_msg("warning: swap file has holes");
 #endif