From: Christoph Hellwig <hch@lst.de> To: Jens Axboe <axboe@kernel.dk> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>, Miquel Raynal <miquel.raynal@bootlin.com>, Richard Weinberger <richard@nod.at>, Vignesh Raghavendra <vigneshr@ti.com>, linux-block@vger.kernel.org, linux-mtd@lists.infradead.org, linux-scsi@vger.kernel.org Subject: [PATCH 1/5] mtd_blkdevs: remove the sector out of range check in do_blktrans_request Date: Tue, 28 Sep 2021 07:22:07 +0200 [thread overview] Message-ID: <20210928052211.112801-2-hch@lst.de> (raw) In-Reply-To: <20210928052211.112801-1-hch@lst.de> The block layer already performs this check, no need to duplicate it in the driver. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/mtd/mtd_blkdevs.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index b8ae1ec14e178..5ce5da705ac00 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -52,17 +52,11 @@ static blk_status_t do_blktrans_request(struct mtd_blktrans_ops *tr, block = blk_rq_pos(req) << 9 >> tr->blkshift; nsect = blk_rq_cur_bytes(req) >> tr->blkshift; - if (req_op(req) == REQ_OP_FLUSH) { + switch (req_op(req)) { + case REQ_OP_FLUSH: if (tr->flush(dev)) return BLK_STS_IOERR; return BLK_STS_OK; - } - - if (blk_rq_pos(req) + blk_rq_cur_sectors(req) > - get_capacity(req->rq_disk)) - return BLK_STS_IOERR; - - switch (req_op(req)) { case REQ_OP_DISCARD: if (tr->discard(dev, block, nsect)) return BLK_STS_IOERR; -- 2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de> To: Jens Axboe <axboe@kernel.dk> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>, Miquel Raynal <miquel.raynal@bootlin.com>, Richard Weinberger <richard@nod.at>, Vignesh Raghavendra <vigneshr@ti.com>, linux-block@vger.kernel.org, linux-mtd@lists.infradead.org, linux-scsi@vger.kernel.org Subject: [PATCH 1/5] mtd_blkdevs: remove the sector out of range check in do_blktrans_request Date: Tue, 28 Sep 2021 07:22:07 +0200 [thread overview] Message-ID: <20210928052211.112801-2-hch@lst.de> (raw) In-Reply-To: <20210928052211.112801-1-hch@lst.de> The block layer already performs this check, no need to duplicate it in the driver. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/mtd/mtd_blkdevs.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index b8ae1ec14e178..5ce5da705ac00 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -52,17 +52,11 @@ static blk_status_t do_blktrans_request(struct mtd_blktrans_ops *tr, block = blk_rq_pos(req) << 9 >> tr->blkshift; nsect = blk_rq_cur_bytes(req) >> tr->blkshift; - if (req_op(req) == REQ_OP_FLUSH) { + switch (req_op(req)) { + case REQ_OP_FLUSH: if (tr->flush(dev)) return BLK_STS_IOERR; return BLK_STS_OK; - } - - if (blk_rq_pos(req) + blk_rq_cur_sectors(req) > - get_capacity(req->rq_disk)) - return BLK_STS_IOERR; - - switch (req_op(req)) { case REQ_OP_DISCARD: if (tr->discard(dev, block, nsect)) return BLK_STS_IOERR; -- 2.30.2 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2021-09-28 5:23 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-28 5:22 remove ->rq_disk Christoph Hellwig 2021-09-28 5:22 ` Christoph Hellwig 2021-09-28 5:22 ` Christoph Hellwig [this message] 2021-09-28 5:22 ` [PATCH 1/5] mtd_blkdevs: remove the sector out of range check in do_blktrans_request Christoph Hellwig 2021-09-28 8:51 ` Miquel Raynal 2021-09-28 8:51 ` Miquel Raynal 2021-09-28 5:22 ` [PATCH 2/5] block: don't check ->rq_disk in merges Christoph Hellwig 2021-09-28 5:22 ` Christoph Hellwig 2021-09-28 5:22 ` [PATCH 3/5] block: remove the ->rq_disk field in struct request Christoph Hellwig 2021-09-28 5:22 ` Christoph Hellwig 2021-09-28 21:11 ` Chaitanya Kulkarni 2021-09-28 21:11 ` Chaitanya Kulkarni 2021-09-28 21:21 ` Chaitanya Kulkarni 2021-09-28 21:21 ` Chaitanya Kulkarni 2021-09-28 21:22 ` Chaitanya Kulkarni 2021-09-28 21:22 ` Chaitanya Kulkarni 2021-09-28 5:22 ` [PATCH 4/5] block: remove the gendisk argument to blk_execute_rq Christoph Hellwig 2021-09-28 5:22 ` Christoph Hellwig 2021-09-28 21:23 ` Chaitanya Kulkarni 2021-09-28 21:23 ` Chaitanya Kulkarni 2021-09-28 5:22 ` [PATCH 5/5] scsi: remove the gendisk argument to scsi_ioctl Christoph Hellwig 2021-09-28 5:22 ` Christoph Hellwig 2021-09-28 21:24 ` Chaitanya Kulkarni 2021-09-28 21:24 ` Chaitanya Kulkarni 2021-09-28 14:32 ` remove ->rq_disk Ming Lei 2021-09-28 14:32 ` Ming Lei 2021-09-29 7:07 ` Christoph Hellwig 2021-09-29 7:07 ` Christoph Hellwig 2021-09-29 8:04 ` Ming Lei 2021-09-29 8:04 ` Ming Lei 2021-11-26 12:17 remove ->rq_disk v2 Christoph Hellwig 2021-11-26 12:17 ` [PATCH 1/5] mtd_blkdevs: remove the sector out of range check in do_blktrans_request Christoph Hellwig 2021-11-26 12:17 ` Christoph Hellwig
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210928052211.112801-2-hch@lst.de \ --to=hch@lst.de \ --cc=axboe@kernel.dk \ --cc=linux-block@vger.kernel.org \ --cc=linux-mtd@lists.infradead.org \ --cc=linux-scsi@vger.kernel.org \ --cc=martin.petersen@oracle.com \ --cc=miquel.raynal@bootlin.com \ --cc=richard@nod.at \ --cc=vigneshr@ti.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.