]> git.karo-electronics.de Git - linux-beck.git/blobdiff - drivers/block/zram/zram_drv.c
zram: correct offset usage in zram_bio_discard
[linux-beck.git] / drivers / block / zram / zram_drv.c
index 9849b5233bf4c7a4e3d6eb1d12a6c4215400a1a2..48eccb350180d90c333d224a9219dab27a1d60ab 100644 (file)
@@ -572,10 +572,10 @@ static void zram_bio_discard(struct zram *zram, u32 index,
         * skipping this logical block is appropriate here.
         */
        if (offset) {
-               if (n < offset)
+               if (n <= (PAGE_SIZE - offset))
                        return;
 
-               n -= offset;
+               n -= (PAGE_SIZE - offset);
                index++;
        }