History

Convert 'alloc_obj' family to use the new default GFP_KERNEL argument

This was done entirely with mindless brute force, using git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' | xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/' to convert the new alloc_obj() users that had a simple GFP_KERNEL argument to just drop that argument. Note that due to the extreme simplicity of the scripting, any slightly more complex cases spread over multiple lines would not be triggered: they definitely exist, but this covers the vast bulk of the cases, and the resulting diff is also then easier to check automatically. For the same reason the 'flex' versions will be done as a separate conversion.

Linus Torvalds committed 8 months ago

Commit bf4afc51 parent e19e1b46673 files · +13013 −13013Browse files

Showing the changes to kernel/module (5 of 6673 files). Show all

Unified · Split

5 files
  1. kernel/module/dups.c +1 −1
  2. kernel/module/main.c +1 −1
  3. kernel/module/stats.c +1 −1
  4. kernel/module/sysfs.c +2 −2
  5. kernel/module/tracking.c +1 −1
kernel/module/dups.c+1−1
@@ -125,7 +125,7 @@ bool kmod_dup_request_exists_wait(char *module_name, bool wait, int *dup_ret) · 124 unmodified lines
125 * Pre-allocate the entry in case we have to use it later125 * Pre-allocate the entry in case we have to use it later
126 * to avoid contention with the mutex.126 * to avoid contention with the mutex.
127 */127 */
128 new_kmod_req = kzalloc_obj(*new_kmod_req, GFP_KERNEL);128 new_kmod_req = kzalloc_obj(*new_kmod_req);
129 if (!new_kmod_req)129 if (!new_kmod_req)
130 return false;130 return false;
131 131
kernel/module/main.c+1−1
@@ -3024,7 +3024,7 @@ static noinline int do_init_module(struct module *mod) · 3023 unmodified lines
3024 }3024 }
3025#endif3025#endif
3026 3026
3027 freeinit = kmalloc_obj(*freeinit, GFP_KERNEL);3027 freeinit = kmalloc_obj(*freeinit);
3028 if (!freeinit) {3028 if (!freeinit) {
3029 ret = -ENOMEM;3029 ret = -ENOMEM;
3030 goto fail;3030 goto fail;
kernel/module/stats.c+1−1
@@ -250,7 +250,7 @@ int try_add_failed_module(const char *name, enum fail_dup_mod_reason reason) · 249 unmodified lines
250 }250 }
251 }251 }
252 252
253 mod_fail = kzalloc_obj(*mod_fail, GFP_KERNEL);253 mod_fail = kzalloc_obj(*mod_fail);
254 if (!mod_fail)254 if (!mod_fail)
255 return -ENOMEM;255 return -ENOMEM;
256 memcpy(mod_fail->name, name, strlen(name));256 memcpy(mod_fail->name, name, strlen(name));
kernel/module/sysfs.c+2−2
@@ -78,7 +78,7 @@ static int add_sect_attrs(struct module *mod, const struct load_info *info) · 77 unmodified lines
78 if (!sect_attrs)78 if (!sect_attrs)
79 return -ENOMEM;79 return -ENOMEM;
80 80
81 gattr = kzalloc_objs(*gattr, nloaded + 1, GFP_KERNEL);81 gattr = kzalloc_objs(*gattr, nloaded + 1);
82 if (!gattr) {82 if (!gattr) {
83 kfree(sect_attrs);83 kfree(sect_attrs);
84 return -ENOMEM;84 return -ENOMEM;
@@ -170,7 +170,7 @@ static int add_notes_attrs(struct module *mod, const struct load_info *info) · 85 unmodified lines
170 if (!notes_attrs)170 if (!notes_attrs)
171 return -ENOMEM;171 return -ENOMEM;
172 172
173 gattr = kzalloc_objs(*gattr, notes + 1, GFP_KERNEL);173 gattr = kzalloc_objs(*gattr, notes + 1);
174 if (!gattr) {174 if (!gattr) {
175 kfree(notes_attrs);175 kfree(notes_attrs);
176 return -ENOMEM;176 return -ENOMEM;
kernel/module/tracking.c+1−1
@@ -33,7 +33,7 @@ int try_add_tainted_module(struct module *mod) · 32 unmodified lines
33 }33 }
34 }34 }
35 35
36 mod_taint = kmalloc_obj(*mod_taint, GFP_KERNEL);36 mod_taint = kmalloc_obj(*mod_taint);
37 if (unlikely(!mod_taint))37 if (unlikely(!mod_taint))
38 return -ENOMEM;38 return -ENOMEM;
39 strscpy(mod_taint->name, mod->name, MODULE_NAME_LEN);39 strscpy(mod_taint->name, mod->name, MODULE_NAME_LEN);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t