From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752958AbdHIOMK (ORCPT ); Wed, 9 Aug 2017 10:12:10 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34771 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752694AbdHIOMH (ORCPT ); Wed, 9 Aug 2017 10:12:07 -0400 From: Benjamin Block To: "James E . J . Bottomley" , "Martin K . Petersen" , Jens Axboe Cc: Benjamin Block , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, Johannes Thumshirn , Christoph Hellwig , Steffen Maier , open-iscsi@googlegroups.com Subject: [RFC PATCH 2/6] bsg: assign sense_len instead of fixed SCSI_SENSE_BUFFERSIZE Date: Wed, 9 Aug 2017 16:11:16 +0200 X-Mailer: git-send-email 2.12.2 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 x-cbid: 17080914-0012-0000-0000-0000056D9D21 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17080914-0013-0000-0000-000018E4905D Message-Id: <2dd8381929af2037a6eec3086256f54f55c01e78.1502120928.git.bblock@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-08-09_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1708090220 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We do set rq->sense_len when we assigne the reply-buffer in blk_fill_sgv4_hdr_rq(). No point in possibly deviating from this value later on. bsg-lib.h specifies: unsigned int reply_len; /* * On entry : reply_len indicates the buffer size allocated for * the reply. * * ... */ Signed-off-by: Benjamin Block --- block/bsg-lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/bsg-lib.c b/block/bsg-lib.c index c4513b23f57a..c7c2c6bbb5ae 100644 --- a/block/bsg-lib.c +++ b/block/bsg-lib.c @@ -147,8 +147,8 @@ static int bsg_create_job(struct device *dev, struct request *req) job->request = rq->cmd; job->request_len = rq->cmd_len; job->reply = rq->sense; - job->reply_len = SCSI_SENSE_BUFFERSIZE; /* Size of sense buffer - * allocated */ + job->reply_len = rq->sense_len; + if (req->bio) { ret = bsg_map_buffer(&job->request_payload, req); if (ret) -- 2.12.2