From: Dave Jones Date: Thu, 13 Jan 2011 00:59:59 +0000 (-0800) Subject: checkpatch: check for world-writeable sysfs/debugfs files X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=88f8831c055858179a7844d9dd4ddd7d3621322e;p=deliverable%2Flinux.git checkpatch: check for world-writeable sysfs/debugfs files Exporting world writable sysfs/debugfs files is usually a bad thing. Warn about it. Signed-off-by: Dave Jones Cc: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index ddd27d8e6312..fd9560ea976c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2897,6 +2897,11 @@ sub process { ERROR("lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr); } } + + if ($line =~ /debugfs_create_file.*S_IWUGO/ || + $line =~ /DEVICE_ATTR.*S_IWUGO/ ) { + WARN("Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr); + } } # If we have no input at all, then there is nothing to report on