git: 49da0242e798 - main - sdio: Do not allow setting a block size if function doesn't support it

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Wed, 10 Aug 2022 20:07:34 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=49da0242e798ade8a578036929bff493a2d6ef75

commit 49da0242e798ade8a578036929bff493a2d6ef75
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2021-05-26 11:15:58 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-08-10 20:07:24 +0000

    sdio: Do not allow setting a block size if function doesn't support it
---
 sys/dev/sdio/sdio_subr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/dev/sdio/sdio_subr.c b/sys/dev/sdio/sdio_subr.c
index 0885b16550a6..50b741ff2a27 100644
--- a/sys/dev/sdio/sdio_subr.c
+++ b/sys/dev/sdio/sdio_subr.c
@@ -121,6 +121,9 @@ sdio_set_block_size(struct sdio_func *f, uint16_t bs)
 	uint32_t addr;
 	uint16_t v;
 
+	if (bs > f->max_blksize)
+		return (EOPNOTSUPP);
+
 	if (!sdio_get_support_multiblk(f->dev))
 		return (EOPNOTSUPP);