]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - block/blk-barrier.c
drm/i915: Fix read outside array bounds in restoring the SWF10 range.
[mv-sheeva.git] / block / blk-barrier.c
index 0d98054cdbd77c19e4bc35397aef702c8edc3e22..30022b4e2f6306b36d6c878efc0ea4abb28e5082 100644 (file)
@@ -388,10 +388,10 @@ int blkdev_issue_discard(struct block_device *bdev,
 
                bio->bi_sector = sector;
 
-               if (nr_sects > q->max_hw_sectors) {
-                       bio->bi_size = q->max_hw_sectors << 9;
-                       nr_sects -= q->max_hw_sectors;
-                       sector += q->max_hw_sectors;
+               if (nr_sects > queue_max_hw_sectors(q)) {
+                       bio->bi_size = queue_max_hw_sectors(q) << 9;
+                       nr_sects -= queue_max_hw_sectors(q);
+                       sector += queue_max_hw_sectors(q);
                } else {
                        bio->bi_size = nr_sects << 9;
                        nr_sects = 0;