arm64: dts: rockchip: update tsadc node for rk3368
[firefly-linux-kernel-4.4.55.git] / mm / swapfile.c
index 58877312cf6b94b74da00b8913bf8db64d56ab26..c1a0f3dea8b5beb197b57619e8153f7d17483f8a 100644 (file)
@@ -2225,6 +2225,8 @@ static unsigned long read_swap_header(struct swap_info_struct *p,
                swab32s(&swap_header->info.version);
                swab32s(&swap_header->info.last_page);
                swab32s(&swap_header->info.nr_badpages);
+               if (swap_header->info.nr_badpages > MAX_SWAP_BADPAGES)
+                       return 0;
                for (i = 0; i < swap_header->info.nr_badpages; i++)
                        swab32s(&swap_header->info.badpages[i]);
        }