From: Greg Kroah-Hartman Date: Tue, 16 Nov 2021 13:13:01 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v5.4.160~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=078e89ec7d26e8c0e5ef934e3c277f669e29a27b;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: ataflop-fix-off-by-one-in-ataflop_probe.patch --- diff --git a/queue-5.10/ataflop-fix-off-by-one-in-ataflop_probe.patch b/queue-5.10/ataflop-fix-off-by-one-in-ataflop_probe.patch new file mode 100644 index 00000000000..9316fd19f05 --- /dev/null +++ b/queue-5.10/ataflop-fix-off-by-one-in-ataflop_probe.patch @@ -0,0 +1,36 @@ +From b777f4c47781df6b23e3f4df6fdb92d9aceac7bb Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 21 Apr 2021 13:19:45 +0300 +Subject: ataflop: fix off by one in ataflop_probe() + +From: Dan Carpenter + +commit b777f4c47781df6b23e3f4df6fdb92d9aceac7bb upstream. + +Smatch complains that the "type > NUM_DISK_MINORS" should be >= +instead of >. We also need to subtract one from "type" at the start. + +Fixes: bf9c0538e485 ("ataflop: use a separate gendisk for each media format") +Reported-by: kernel test robot +Signed-off-by: Dan Carpenter +Reviewed-by: Christoph Hellwig +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + drivers/block/ataflop.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/block/ataflop.c ++++ b/drivers/block/ataflop.c +@@ -2021,7 +2021,10 @@ static void ataflop_probe(dev_t dev) + int drive = MINOR(dev) & 3; + int type = MINOR(dev) >> 2; + +- if (drive >= FD_MAX_UNITS || type > NUM_DISK_MINORS) ++ if (type) ++ type--; ++ ++ if (drive >= FD_MAX_UNITS || type >= NUM_DISK_MINORS) + return; + if (!unit[drive].disk[type]) { + if (ataflop_alloc_disk(drive, type) == 0) { diff --git a/queue-5.10/series b/queue-5.10/series index 8f42e34174d..c5142998503 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -574,3 +574,4 @@ sunrpc-partial-revert-of-commit-6f9f17287e78.patch ath10k-fix-invalid-dma_addr_t-token-assignment.patch mmc-moxart-fix-null-pointer-dereference-on-pointer-host.patch selftests-bpf-fix-also-no-alu32-strobemeta-selftest.patch +ataflop-fix-off-by-one-in-ataflop_probe.patch