diff mbox series

block: add prio data check for IOPRIO_CLASS_IDLE

Message ID 20181227001910.3343-1-cgxu519@gmx.com (mailing list archive)
State New, archived
Headers show
Series block: add prio data check for IOPRIO_CLASS_IDLE | expand

Commit Message

Chengguang Xu Dec. 27, 2018, 12:19 a.m. UTC
The idle class does not have class data, so let's
fall through to case IOPRIO_CLASS_NONE to check
the specification of data field.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 block/ioprio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jens Axboe Dec. 27, 2018, 3:57 p.m. UTC | #1
On 12/26/18 5:19 PM, Chengguang Xu wrote:
> The idle class does not have class data, so let's
> fall through to case IOPRIO_CLASS_NONE to check
> the specification of data field.

I'm not going to apply this, as it's potentially changing app
behavior. We arguably should have had this check with it was
added originally, we can't add it after the fact as it could
break applications that never cleared the data field for
the idle class.
diff mbox series

Patch

diff --git a/block/ioprio.c b/block/ioprio.c
index 8c0f971015c9..63db916f86fb 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -78,7 +78,7 @@  int ioprio_check_cap(int ioprio)
 
 			break;
 		case IOPRIO_CLASS_IDLE:
-			break;
+			/* fall through */
 		case IOPRIO_CLASS_NONE:
 			if (data)
 				return -EINVAL;