[PATCH 4/7] security: apparmor: apparmorfs.c WARN_ON vs BUG_ON

Walt Feasel waltfeasel at gmail.com
Sat Nov 26 03:43:22 EST 2016


Make style modifications for:
CHECK: Avoid crashing the kernel - try using WARN_ON
& recovery code rather than BUG() or BUG_ON()

Signed-off-by: Walt Feasel <waltfeasel at gmail.com>
---
Not sure if correct use. Seems if copy_size > alloc_size
it is corrected by writing partial data and return an error.

 security/apparmor/apparmorfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index c5701f3..d759c78 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -87,7 +87,7 @@ static char *aa_simple_write_to_buffer(int op, const char __user *userbuf,
 {
 	char *data;
 
-	BUG_ON(copy_size > alloc_size);
+	WARN_ON(copy_size > alloc_size);
 
 	if (*pos != 0)
 		/* only writes from pos 0, that is complete writes */
-- 
2.1.4




More information about the Kernelnewbies mailing list