[PATCH 1/2] sched: sched_getattr should return E2BIG, not EFBIG

From: Thadeu Lima de Souza Cascardo
Date: Tue Sep 03 2019 - 13:17:02 EST


As documented and the behavior before commit 22400674945c (sched: Simplify
return logic in sched_read_attr()), sched_getattr should return E2BIG instead
of EFBIG when there is not enough space to copy sched_attr.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxxxxx>
Fixes: 22400674945c (sched: Simplify return logic in sched_read_attr())
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2477893dd069..0fd67281e656 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5129,7 +5129,7 @@ static int sched_read_attr(struct sched_attr __user *uattr,

for (; addr < end; addr++) {
if (*addr)
- return -EFBIG;
+ return -E2BIG;
}

attr->size = usize;
--
2.20.1