diff mbox series

[v2,1/2] mm: kmemleak: change error at _write when kmemleak is disabled

Message ID 20190612155231.19448-1-andrealmeid@collabora.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] mm: kmemleak: change error at _write when kmemleak is disabled | expand

Commit Message

André Almeida June 12, 2019, 3:52 p.m. UTC
According to POSIX, EBUSY means that the "device or resource is busy",
and this can lead to people thinking that the file
`/sys/kernel/debug/kmemleak/` is somehow locked or being used by other
process. Change this error code to a more appropriate one.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
---
Hello,

This time I've added the mailing list, not only the maintainers.

Changes in v2:
- Remove pr_error.
- Replace EINVAL for EPERM, since the command isn't invalid, in fact, the
user don't have the permission to trigger commands when kmemleak is
disabled.
- Reword the commit message to be clearer the rationale behind the
patch.

 mm/kmemleak.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Catalin Marinas June 13, 2019, 12:22 p.m. UTC | #1
On Wed, Jun 12, 2019 at 12:52:30PM -0300, André Almeida wrote:
> According to POSIX, EBUSY means that the "device or resource is busy",
> and this can lead to people thinking that the file
> `/sys/kernel/debug/kmemleak/` is somehow locked or being used by other
> process. Change this error code to a more appropriate one.
> 
> Signed-off-by: André Almeida <andrealmeid@collabora.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
diff mbox series

Patch

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 9dd581d11565..848333a591fa 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1866,7 +1866,7 @@  static ssize_t kmemleak_write(struct file *file, const char __user *user_buf,
 	}
 
 	if (!kmemleak_enabled) {
-		ret = -EBUSY;
+		ret = -EPERM;
 		goto out;
 	}