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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20160802115344.7912-1-baolex.ni@intel.com>
Date:	Tue,  2 Aug 2016 19:53:44 +0800
From:	Baole Ni <baolex.ni@...el.com>
To:	richardcochran@...il.com, benh@...nel.crashing.org,
	paulus@...ba.org, mpe@...erman.id.au, dwmw2@...radead.org,
	m.chehab@...sung.com, pawel@...iak.com, m.szyprowski@...sung.com,
	kyungmin.park@...sung.com, k.kozlowski@...sung.com
Cc:	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	chuansheng.liu@...el.com, baolex.ni@...el.com
Subject: [PATCH 0869/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/ptp/ptp_sysfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index 302e626..e957e42 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -28,7 +28,7 @@ static ssize_t clock_name_show(struct device *dev,
 	struct ptp_clock *ptp = dev_get_drvdata(dev);
 	return snprintf(page, PAGE_SIZE-1, "%s\n", ptp->info->name);
 }
-static DEVICE_ATTR(clock_name, 0444, clock_name_show, NULL);
+static DEVICE_ATTR(clock_name, S_IRUSR | S_IRGRP | S_IROTH, clock_name_show, NULL);
 
 #define PTP_SHOW_INT(name, var)						\
 static ssize_t var##_show(struct device *dev,				\
@@ -235,10 +235,10 @@ static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(extts_enable, 0220, NULL, extts_enable_store);
-static DEVICE_ATTR(fifo,         0444, extts_fifo_show, NULL);
-static DEVICE_ATTR(period,       0220, NULL, period_store);
-static DEVICE_ATTR(pps_enable,   0220, NULL, pps_enable_store);
+static DEVICE_ATTR(extts_enable, S_IWUSR | S_IWGRP, NULL, extts_enable_store);
+static DEVICE_ATTR(fifo,         S_IRUSR | S_IRGRP | S_IROTH, extts_fifo_show, NULL);
+static DEVICE_ATTR(period,       S_IWUSR | S_IWGRP, NULL, period_store);
+static DEVICE_ATTR(pps_enable,   S_IWUSR | S_IWGRP, NULL, pps_enable_store);
 
 int ptp_cleanup_sysfs(struct ptp_clock *ptp)
 {
-- 
2.9.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ