From: Ming Lei Date: Tue, 24 Nov 2015 02:35:31 +0000 (+0800) Subject: blk-merge: warn if figured out segment number is bigger than nr_phys_segments X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=12e57f59ca3344a588531f68eeede45666e8a6e0;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git blk-merge: warn if figured out segment number is bigger than nr_phys_segments We had seen lots of reports of this kind issue, so add one warnning in blk-merge, then it can be triggered easily and avoid to depend on warning/bug from drivers. Signed-off-by: Ming Lei Signed-off-by: Jens Axboe --- diff --git a/block/blk-merge.c b/block/blk-merge.c index 50793cdc5331..41a55ba0d78e 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -428,6 +428,12 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, if (sg) sg_mark_end(sg); + /* + * Something must have been wrong if the figured number of + * segment is bigger than number of req's physical segments + */ + WARN_ON(nsegs > rq->nr_phys_segments); + return nsegs; } EXPORT_SYMBOL(blk_rq_map_sg);