lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue,  2 Aug 2016 18:39:19 +0800
From:	Baole Ni <baolex.ni@...el.com>
To:	philipp.reisner@...bit.com, lars.ellenberg@...bit.com,
	pavel@....cz, gregkh@...uxfoundation.org, hpa@...or.com,
	x86@...nel.org
Cc:	drbd-dev@...ts.linbit.com, linux-kernel@...r.kernel.org,
	chuansheng.liu@...el.com, baolex.ni@...el.com
Subject: [PATCH 0083/1285] Replace numeric parameter like 0444 with macro

I find that the developers often just specified the numeric value
when calling a macro which is defined with a parameter for access permission.
As we know, these numeric value for access permission have had the corresponding macro,
and that using macro can improve the robustness and readability of the code,
thus, I suggest replacing the numeric parameter with the macro.

Signed-off-by: Chuansheng Liu <chuansheng.liu@...el.com>
Signed-off-by: Baole Ni <baolex.ni@...el.com>
---
 drivers/block/drbd/drbd_main.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 2ba1494..467e9da 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -80,10 +80,10 @@ MODULE_ALIAS_BLOCKDEV_MAJOR(DRBD_MAJOR);
 MODULE_PARM_DESC(allow_oos, "DONT USE!");
 /* thanks to these macros, if compiled into the kernel (not-module),
  * this becomes the boot parameter drbd.minor_count */
-module_param(minor_count, uint, 0444);
-module_param(disable_sendpage, bool, 0644);
+module_param(minor_count, uint, S_IRUSR | S_IRGRP | S_IROTH);
+module_param(disable_sendpage, bool, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 module_param(allow_oos, bool, 0);
-module_param(proc_details, int, 0644);
+module_param(proc_details, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
 #ifdef CONFIG_DRBD_FAULT_INJECTION
 int enable_faults;
@@ -91,13 +91,13 @@ int fault_rate;
 static int fault_count;
 int fault_devs;
 /* bitmap of enabled faults */
-module_param(enable_faults, int, 0664);
+module_param(enable_faults, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
 /* fault rate % value - applies to all enabled faults */
-module_param(fault_rate, int, 0664);
+module_param(fault_rate, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
 /* count of faults inserted */
-module_param(fault_count, int, 0664);
+module_param(fault_count, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
 /* bitmap of devices to insert faults on */
-module_param(fault_devs, int, 0644);
+module_param(fault_devs, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 #endif
 
 /* module parameter, defined */
@@ -110,7 +110,7 @@ int proc_details;       /* Detail level in proc drbd*/
  * to run. Default is /sbin/drbdadm */
 char usermode_helper[80] = "/sbin/drbdadm";
 
-module_param_string(usermode_helper, usermode_helper, sizeof(usermode_helper), 0644);
+module_param_string(usermode_helper, usermode_helper, sizeof(usermode_helper), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
 /* in 2.6.x, our device mapping and config info contains our virtual gendisks
  * as member "struct gendisk *vdisk;"
-- 
2.9.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ