Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bf5ecda

Browse files
JoePerchesintel-lab-lkp
authored andcommitted
drm: Convert S_<FOO> permission uses to octal
Convert S_<FOO> permissions to the more readable octal. Link: https://lore.kernel.org/lkml/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com/ Done using: $ git ls-files -- drivers/gpu/drm/*.[ch] | xargs ./scripts/checkpatch.pl -f --fix-inplace --types=SYMBOLIC_PERMS No difference in generated .o files allyesconfig x86-64 The files below were not compiled for x86-64: drivers/gpu/drm/msm/adreno/a5xx_debugfs.c drivers/gpu/drm/msm/msm_debugfs.c drivers/gpu/drm/msm/msm_perf.c drivers/gpu/drm/msm/msm_rd.c drivers/gpu/drm/sti/sti_drv.c checkpatch does report several places where permissions perhaps could be downgraded. None of these locations are modified by this patch. WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#165: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1146: + debugfs_create_file("ras_ctrl", 0666, con->dir, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#165: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1146: + debugfs_create_file("ras_ctrl", 0666, con->dir, adev, &amdgpu_ras_debugfs_ctrl_ops); WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#168: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1148: + debugfs_create_file("ras_eeprom_reset", 0666, con->dir, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#168: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1148: + debugfs_create_file("ras_eeprom_reset", 0666, con->dir, adev, &amdgpu_ras_debugfs_eeprom_ops); WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#177: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1159: + debugfs_create_bool("auto_reboot", 0666, con->dir, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#177: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1159: + debugfs_create_bool("auto_reboot", 0666, con->dir, &con->reboot); WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#688: FILE: drivers/gpu/drm/msm/adreno/a5xx_debugfs.c:157: + debugfs_create_file("reset", 0222, minor->debugfs_root, dev, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#688: FILE: drivers/gpu/drm/msm/adreno/a5xx_debugfs.c:157: + debugfs_create_file("reset", 0222, minor->debugfs_root, dev, &reset_fops); Signed-off-by: Joe Perches <[email protected]>
1 parent 671176b commit bf5ecda

36 files changed

+137
-137
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
12241224

12251225
for (i = 0; i < ARRAY_SIZE(debugfs_regs); i++) {
12261226
ent = debugfs_create_file(debugfs_regs_names[i],
1227-
S_IFREG | S_IRUGO, root,
1227+
S_IFREG | 0444, root,
12281228
adev, debugfs_regs[i]);
12291229
if (!i && !IS_ERR_OR_NULL(ent))
12301230
i_size_write(ent->d_inode, adev->rmmio_size);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static ssize_t amdgpu_device_get_pcie_replay_count(struct device *dev,
139139
return snprintf(buf, PAGE_SIZE, "%llu\n", cnt);
140140
}
141141

142-
static DEVICE_ATTR(pcie_replay_count, S_IRUGO,
142+
static DEVICE_ATTR(pcie_replay_count, 0444,
143143
amdgpu_device_get_pcie_replay_count, NULL);
144144

145145
static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev);
@@ -163,7 +163,7 @@ static ssize_t amdgpu_device_get_product_name(struct device *dev,
163163
return snprintf(buf, PAGE_SIZE, "%s\n", adev->product_name);
164164
}
165165

166-
static DEVICE_ATTR(product_name, S_IRUGO,
166+
static DEVICE_ATTR(product_name, 0444,
167167
amdgpu_device_get_product_name, NULL);
168168

169169
/**
@@ -185,7 +185,7 @@ static ssize_t amdgpu_device_get_product_number(struct device *dev,
185185
return snprintf(buf, PAGE_SIZE, "%s\n", adev->product_number);
186186
}
187187

188-
static DEVICE_ATTR(product_number, S_IRUGO,
188+
static DEVICE_ATTR(product_number, 0444,
189189
amdgpu_device_get_product_number, NULL);
190190

191191
/**
@@ -207,7 +207,7 @@ static ssize_t amdgpu_device_get_serial_number(struct device *dev,
207207
return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
208208
}
209209

210-
static DEVICE_ATTR(serial_number, S_IRUGO,
210+
static DEVICE_ATTR(serial_number, 0444,
211211
amdgpu_device_get_serial_number, NULL);
212212

213213
/**

drivers/gpu/drm/amd/amdgpu/amdgpu_fw_attestation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void amdgpu_fw_attestation_debugfs_init(struct amdgpu_device *adev)
133133
return;
134134

135135
debugfs_create_file("amdgpu_fw_attestation",
136-
S_IRUSR,
136+
0400,
137137
adev_to_drm(adev)->primary->debugfs_root,
138138
adev,
139139
&amdgpu_fw_attestation_debugfs_ops);

drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ static ssize_t amdgpu_mem_info_gtt_used_show(struct device *dev,
7272
amdgpu_gtt_mgr_usage(man));
7373
}
7474

75-
static DEVICE_ATTR(mem_info_gtt_total, S_IRUGO,
75+
static DEVICE_ATTR(mem_info_gtt_total, 0444,
7676
amdgpu_mem_info_gtt_total_show, NULL);
77-
static DEVICE_ATTR(mem_info_gtt_used, S_IRUGO,
77+
static DEVICE_ATTR(mem_info_gtt_used, 0444,
7878
amdgpu_mem_info_gtt_used_show, NULL);
7979

8080
static const struct ttm_resource_manager_func amdgpu_gtt_mgr_func;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2978,7 +2978,7 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev,
29782978
return count;
29792979
}
29802980

2981-
static DEVICE_ATTR(usbc_pd_fw, S_IRUGO | S_IWUSR,
2981+
static DEVICE_ATTR(usbc_pd_fw, 0644,
29822982
psp_usbc_pd_fw_sysfs_read,
29832983
psp_usbc_pd_fw_sysfs_write);
29842984

drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void amdgpu_rap_debugfs_init(struct amdgpu_device *adev)
121121
if (!adev->psp.rap_context.rap_initialized)
122122
return;
123123

124-
debugfs_create_file("rap_test", S_IWUSR, minor->debugfs_root,
124+
debugfs_create_file("rap_test", 0200, minor->debugfs_root,
125125
adev, &amdgpu_rap_debugfs_ops);
126126
#endif
127127
}

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ int amdgpu_ras_sysfs_create(struct amdgpu_device *adev,
10651065
obj->sysfs_attr = (struct device_attribute){
10661066
.attr = {
10671067
.name = obj->fs_data.sysfs_name,
1068-
.mode = S_IRUGO,
1068+
.mode = 0444,
10691069
},
10701070
.show = amdgpu_ras_sysfs_read,
10711071
};
@@ -1143,9 +1143,9 @@ static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
11431143
struct drm_minor *minor = adev_to_drm(adev)->primary;
11441144

11451145
con->dir = debugfs_create_dir(RAS_FS_NAME, minor->debugfs_root);
1146-
debugfs_create_file("ras_ctrl", S_IWUGO | S_IRUGO, con->dir,
1146+
debugfs_create_file("ras_ctrl", 0666, con->dir,
11471147
adev, &amdgpu_ras_debugfs_ctrl_ops);
1148-
debugfs_create_file("ras_eeprom_reset", S_IWUGO | S_IRUGO, con->dir,
1148+
debugfs_create_file("ras_eeprom_reset", 0666, con->dir,
11491149
adev, &amdgpu_ras_debugfs_eeprom_ops);
11501150

11511151
/*
@@ -1156,7 +1156,7 @@ static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
11561156
* ERREVENT_ATHUB_INTERRUPT generated. Normal GPU recovery routine
11571157
* will never be called.
11581158
*/
1159-
debugfs_create_bool("auto_reboot", S_IWUGO | S_IRUGO, con->dir,
1159+
debugfs_create_bool("auto_reboot", 0666, con->dir,
11601160
&con->reboot);
11611161

11621162
/*
@@ -1183,7 +1183,7 @@ static void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
11831183
sizeof(obj->fs_data.debugfs_name));
11841184

11851185
obj->ent = debugfs_create_file(obj->fs_data.debugfs_name,
1186-
S_IWUGO | S_IRUGO, con->dir, obj,
1186+
0666, con->dir, obj,
11871187
&amdgpu_ras_debugfs_ops);
11881188
}
11891189

@@ -1239,9 +1239,9 @@ static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
12391239
/* debugfs end */
12401240

12411241
/* ras fs */
1242-
static BIN_ATTR(gpu_vram_bad_pages, S_IRUGO,
1242+
static BIN_ATTR(gpu_vram_bad_pages, 0444,
12431243
amdgpu_ras_sysfs_badpages_read, NULL, 0);
1244-
static DEVICE_ATTR(features, S_IRUGO,
1244+
static DEVICE_ATTR(features, 0444,
12451245
amdgpu_ras_sysfs_features_read, NULL);
12461246
static int amdgpu_ras_fs_init(struct amdgpu_device *adev)
12471247
{

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
423423
sprintf(name, "amdgpu_ring_%s", ring->name);
424424

425425
ent = debugfs_create_file(name,
426-
S_IFREG | S_IRUGO, root,
426+
S_IFREG | 0444, root,
427427
ring, &amdgpu_debugfs_ring_fops);
428428
if (!ent)
429429
return -ENOMEM;

drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void amdgpu_securedisplay_debugfs_init(struct amdgpu_device *adev)
170170
if (!adev->psp.securedisplay_context.securedisplay_initialized)
171171
return;
172172

173-
debugfs_create_file("securedisplay_test", S_IWUSR, adev_to_drm(adev)->primary->debugfs_root,
173+
debugfs_create_file("securedisplay_test", 0200, adev_to_drm(adev)->primary->debugfs_root,
174174
adev, &amdgpu_securedisplay_debugfs_ops);
175175
#endif
176176
}

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,7 @@ int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
24992499
for (count = 0; count < ARRAY_SIZE(ttm_debugfs_entries); count++) {
25002500
ent = debugfs_create_file(
25012501
ttm_debugfs_entries[count].name,
2502-
S_IFREG | S_IRUGO, root,
2502+
S_IFREG | 0444, root,
25032503
adev,
25042504
ttm_debugfs_entries[count].fops);
25052505
if (IS_ERR(ent))

0 commit comments

Comments
 (0)