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:50:06 +0800
From:	Baole Ni <baolex.ni@...el.com>
To:	alexander.deucher@....com, christian.koenig@....com,
	airlied@...ux.ie, kyungmin.park@...sung.com, kgene@...nel.org,
	k.kozlowski@...sung.com, dougthompson@...ssion.com, bp@...en8.de
Cc:	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
	chuansheng.liu@...el.com, baolex.ni@...el.com, treding@...dia.com,
	ville.syrjala@...ux.intel.com
Subject: [PATCH 0211/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/gpu/drm/radeon/radeon_drv.c | 64 ++++++++++++++++++-------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index b55aa74..be6f5cc 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -203,100 +203,100 @@ int radeon_uvd = 1;
 int radeon_vce = 1;
 
 MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
-module_param_named(no_wb, radeon_no_wb, int, 0444);
+module_param_named(no_wb, radeon_no_wb, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
-module_param_named(modeset, radeon_modeset, int, 0400);
+module_param_named(modeset, radeon_modeset, int, S_IRUSR);
 
 MODULE_PARM_DESC(dynclks, "Disable/Enable dynamic clocks");
-module_param_named(dynclks, radeon_dynclks, int, 0444);
+module_param_named(dynclks, radeon_dynclks, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx");
-module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444);
+module_param_named(r4xx_atom, radeon_r4xx_atom, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
-module_param_named(vramlimit, radeon_vram_limit, int, 0600);
+module_param_named(vramlimit, radeon_vram_limit, int, S_IRUSR | S_IWUSR);
 
 MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)");
-module_param_named(agpmode, radeon_agpmode, int, 0444);
+module_param_named(agpmode, radeon_agpmode, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(gartsize, "Size of PCIE/IGP gart to setup in megabytes (32, 64, etc., -1 = auto)");
-module_param_named(gartsize, radeon_gart_size, int, 0600);
+module_param_named(gartsize, radeon_gart_size, int, S_IRUSR | S_IWUSR);
 
 MODULE_PARM_DESC(benchmark, "Run benchmark");
-module_param_named(benchmark, radeon_benchmarking, int, 0444);
+module_param_named(benchmark, radeon_benchmarking, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(test, "Run tests");
-module_param_named(test, radeon_testing, int, 0444);
+module_param_named(test, radeon_testing, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(connector_table, "Force connector table");
-module_param_named(connector_table, radeon_connector_table, int, 0444);
+module_param_named(connector_table, radeon_connector_table, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(tv, "TV enable (0 = disable)");
-module_param_named(tv, radeon_tv, int, 0444);
+module_param_named(tv, radeon_tv, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(audio, "Audio enable (-1 = auto, 0 = disable, 1 = enable)");
-module_param_named(audio, radeon_audio, int, 0444);
+module_param_named(audio, radeon_audio, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = high)");
-module_param_named(disp_priority, radeon_disp_priority, int, 0444);
+module_param_named(disp_priority, radeon_disp_priority, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(hw_i2c, "hw i2c engine enable (0 = disable)");
-module_param_named(hw_i2c, radeon_hw_i2c, int, 0444);
+module_param_named(hw_i2c, radeon_hw_i2c, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(pcie_gen2, "PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = enable)");
-module_param_named(pcie_gen2, radeon_pcie_gen2, int, 0444);
+module_param_named(pcie_gen2, radeon_pcie_gen2, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(msi, "MSI support (1 = enable, 0 = disable, -1 = auto)");
-module_param_named(msi, radeon_msi, int, 0444);
+module_param_named(msi, radeon_msi, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default 10000 = 10 seconds, 0 = disable)");
-module_param_named(lockup_timeout, radeon_lockup_timeout, int, 0444);
+module_param_named(lockup_timeout, radeon_lockup_timeout, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(fastfb, "Direct FB access for IGP chips (0 = disable, 1 = enable)");
-module_param_named(fastfb, radeon_fastfb, int, 0444);
+module_param_named(fastfb, radeon_fastfb, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(dpm, "DPM support (1 = enable, 0 = disable, -1 = auto)");
-module_param_named(dpm, radeon_dpm, int, 0444);
+module_param_named(dpm, radeon_dpm, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(aspm, "ASPM support (1 = enable, 0 = disable, -1 = auto)");
-module_param_named(aspm, radeon_aspm, int, 0444);
+module_param_named(aspm, radeon_aspm, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(runpm, "PX runtime pm (1 = force enable, 0 = disable, -1 = PX only default)");
-module_param_named(runpm, radeon_runtime_pm, int, 0444);
+module_param_named(runpm, radeon_runtime_pm, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(hard_reset, "PCI config reset (1 = force enable, 0 = disable (default))");
-module_param_named(hard_reset, radeon_hard_reset, int, 0444);
+module_param_named(hard_reset, radeon_hard_reset, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(vm_size, "VM address space size in gigabytes (default 4GB)");
-module_param_named(vm_size, radeon_vm_size, int, 0444);
+module_param_named(vm_size, radeon_vm_size, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default depending on vm_size)");
-module_param_named(vm_block_size, radeon_vm_block_size, int, 0444);
+module_param_named(vm_block_size, radeon_vm_block_size, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(deep_color, "Deep Color support (1 = enable, 0 = disable (default))");
-module_param_named(deep_color, radeon_deep_color, int, 0444);
+module_param_named(deep_color, radeon_deep_color, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(use_pflipirq, "Pflip irqs for pageflip completion (0 = disable, 1 = as fallback, 2 = exclusive (default))");
-module_param_named(use_pflipirq, radeon_use_pflipirq, int, 0444);
+module_param_named(use_pflipirq, radeon_use_pflipirq, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)");
-module_param_named(bapm, radeon_bapm, int, 0444);
+module_param_named(bapm, radeon_bapm, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(backlight, "backlight support (1 = enable, 0 = disable, -1 = auto)");
-module_param_named(backlight, radeon_backlight, int, 0444);
+module_param_named(backlight, radeon_backlight, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(auxch, "Use native auxch experimental support (1 = enable, 0 = disable, -1 = auto)");
-module_param_named(auxch, radeon_auxch, int, 0444);
+module_param_named(auxch, radeon_auxch, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(mst, "DisplayPort MST experimental support (1 = enable, 0 = disable)");
-module_param_named(mst, radeon_mst, int, 0444);
+module_param_named(mst, radeon_mst, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(uvd, "uvd enable/disable uvd support (1 = enable, 0 = disable)");
-module_param_named(uvd, radeon_uvd, int, 0444);
+module_param_named(uvd, radeon_uvd, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(vce, "vce enable/disable vce support (1 = enable, 0 = disable)");
-module_param_named(vce, radeon_vce, int, 0444);
+module_param_named(vce, radeon_vce, int, S_IRUSR | S_IRGRP | S_IROTH);
 
 static struct pci_device_id pciidlist[] = {
 	radeon_PCI_IDS
-- 
2.9.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ