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 20:05:43 +0800
From:	Baole Ni <baolex.ni@...el.com>
To:	gregkh@...uxfoundation.org, m.chehab@...sung.com,
	m.szyprowski@...sung.com, kyungmin.park@...sung.com,
	k.kozlowski@...sung.com
Cc:	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	chuansheng.liu@...el.com, baolex.ni@...el.com, mina86@...a86.com,
	deepa.kernel@...il.com, mathias.nyman@...ux.intel.com,
	stern@...land.harvard.edu, oneukum@...e.com
Subject: [PATCH 0988/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/usb/wusbcore/cbaf.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c
index da1b872..d37d918 100644
--- a/drivers/usb/wusbcore/cbaf.c
+++ b/drivers/usb/wusbcore/cbaf.c
@@ -355,7 +355,7 @@ static ssize_t cbaf_wusb_chid_store(struct device *dev,
 		return result;
 	return size;
 }
-static DEVICE_ATTR(wusb_chid, 0600, cbaf_wusb_chid_show, cbaf_wusb_chid_store);
+static DEVICE_ATTR(wusb_chid, S_IRUSR | S_IWUSR, cbaf_wusb_chid_show, cbaf_wusb_chid_store);
 
 static ssize_t cbaf_wusb_host_name_show(struct device *dev,
 					struct device_attribute *attr,
@@ -381,7 +381,7 @@ static ssize_t cbaf_wusb_host_name_store(struct device *dev,
 
 	return size;
 }
-static DEVICE_ATTR(wusb_host_name, 0600, cbaf_wusb_host_name_show,
+static DEVICE_ATTR(wusb_host_name, S_IRUSR | S_IWUSR, cbaf_wusb_host_name_show,
 					 cbaf_wusb_host_name_store);
 
 static ssize_t cbaf_wusb_host_band_groups_show(struct device *dev,
@@ -412,7 +412,7 @@ static ssize_t cbaf_wusb_host_band_groups_store(struct device *dev,
 	return size;
 }
 
-static DEVICE_ATTR(wusb_host_band_groups, 0600,
+static DEVICE_ATTR(wusb_host_band_groups, S_IRUSR | S_IWUSR,
 		   cbaf_wusb_host_band_groups_show,
 		   cbaf_wusb_host_band_groups_store);
 
@@ -464,7 +464,7 @@ static ssize_t cbaf_wusb_cdid_store(struct device *dev,
 
 	return size;
 }
-static DEVICE_ATTR(wusb_cdid, 0600, cbaf_wusb_cdid_show, cbaf_wusb_cdid_store);
+static DEVICE_ATTR(wusb_cdid, S_IRUSR | S_IWUSR, cbaf_wusb_cdid_show, cbaf_wusb_cdid_store);
 
 static ssize_t cbaf_wusb_device_band_groups_show(struct device *dev,
 						 struct device_attribute *attr,
@@ -476,7 +476,7 @@ static ssize_t cbaf_wusb_device_band_groups_show(struct device *dev,
 	return scnprintf(buf, PAGE_SIZE, "0x%04x\n", cbaf->device_band_groups);
 }
 
-static DEVICE_ATTR(wusb_device_band_groups, 0600,
+static DEVICE_ATTR(wusb_device_band_groups, S_IRUSR | S_IWUSR,
 		   cbaf_wusb_device_band_groups_show,
 		   NULL);
 
@@ -489,7 +489,7 @@ static ssize_t cbaf_wusb_device_name_show(struct device *dev,
 
 	return scnprintf(buf, PAGE_SIZE, "%s\n", cbaf->device_name);
 }
-static DEVICE_ATTR(wusb_device_name, 0600, cbaf_wusb_device_name_show, NULL);
+static DEVICE_ATTR(wusb_device_name, S_IRUSR | S_IWUSR, cbaf_wusb_device_name_show, NULL);
 
 static const struct wusb_cbaf_cc_data cbaf_cc_data_defaults = {
 	.AssociationTypeId_hdr    = WUSB_AR_AssociationTypeId,
@@ -573,7 +573,7 @@ static ssize_t cbaf_wusb_ck_store(struct device *dev,
 
 	return size;
 }
-static DEVICE_ATTR(wusb_ck, 0600, NULL, cbaf_wusb_ck_store);
+static DEVICE_ATTR(wusb_ck, S_IRUSR | S_IWUSR, NULL, cbaf_wusb_ck_store);
 
 static struct attribute *cbaf_dev_attrs[] = {
 	&dev_attr_wusb_host_name.attr,
-- 
2.9.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ