Variable k should not be used in call to sg_mk_kern_bio(). Reported-by: Colin Ian King <colin.king@xxxxxxxxxxxxx> Signed-off-by: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> --- drivers/scsi/sg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 2d4bbc1a1727..7d4a0fd9ee32 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -2987,7 +2987,7 @@ sg_rq_map_kern(struct sg_request *srp, struct request_queue *q, struct request * return 0; if (rw_ind == WRITE) op_flags = REQ_SYNC | REQ_IDLE; - bio = sg_mk_kern_bio(num_sgat - k); + bio = sg_mk_kern_bio(num_sgat); if (!bio) return -ENOMEM; bio->bi_opf = req_op(rqq) | op_flags; -- 2.25.1