21
21
#ifdef CONFIG_KALLSYMS
22
22
struct module_sect_attr {
23
23
struct bin_attribute battr ;
24
- unsigned long address ;
25
24
};
26
25
27
26
struct module_sect_attrs {
@@ -34,8 +33,6 @@ static ssize_t module_sect_read(struct file *file, struct kobject *kobj,
34
33
struct bin_attribute * battr ,
35
34
char * buf , loff_t pos , size_t count )
36
35
{
37
- struct module_sect_attr * sattr =
38
- container_of (battr , struct module_sect_attr , battr );
39
36
char bounce [MODULE_SECT_READ_SIZE + 1 ];
40
37
size_t wrote ;
41
38
@@ -52,7 +49,7 @@ static ssize_t module_sect_read(struct file *file, struct kobject *kobj,
52
49
*/
53
50
wrote = scnprintf (bounce , sizeof (bounce ), "0x%px\n" ,
54
51
kallsyms_show_value (file -> f_cred )
55
- ? ( void * ) sattr -> address : NULL );
52
+ ? battr -> private : NULL );
56
53
count = min (count , wrote );
57
54
memcpy (buf , bounce , count );
58
55
@@ -99,14 +96,14 @@ static int add_sect_attrs(struct module *mod, const struct load_info *info)
99
96
if (sect_empty (sec ))
100
97
continue ;
101
98
sysfs_bin_attr_init (& sattr -> battr );
102
- sattr -> address = sec -> sh_addr ;
103
99
sattr -> battr .attr .name =
104
100
kstrdup (info -> secstrings + sec -> sh_name , GFP_KERNEL );
105
101
if (!sattr -> battr .attr .name ) {
106
102
ret = - ENOMEM ;
107
103
goto out ;
108
104
}
109
105
sattr -> battr .read = module_sect_read ;
106
+ sattr -> battr .private = (void * )sec -> sh_addr ;
110
107
sattr -> battr .size = MODULE_SECT_READ_SIZE ;
111
108
sattr -> battr .attr .mode = 0400 ;
112
109
* (gattr ++ ) = & (sattr ++ )-> battr ;
0 commit comments