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
125125 * Pre-allocate the entry in case we have to use it later
126126 * to avoid contention with the mutex.
127127 */
128− new_kmod_req = kzalloc_obj(*new_kmod_req, GFP_KERNEL);
128+ new_kmod_req = kzalloc_obj(*new_kmod_req);
129129 if (!new_kmod_req)
130130 return false;
131131
kernel/module/main.c+1−1
@@ -3024,7 +3024,7 @@ static noinline int do_init_module(struct module *mod) · 3023 unmodified lines
30243024 }
30253025 #endif
30263026
3027− freeinit = kmalloc_obj(*freeinit, GFP_KERNEL);
3027+ freeinit = kmalloc_obj(*freeinit);
30283028 if (!freeinit) {
30293029 ret = -ENOMEM;
30303030 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
250250 }
251251 }
252252
253− mod_fail = kzalloc_obj(*mod_fail, GFP_KERNEL);
253+ mod_fail = kzalloc_obj(*mod_fail);
254254 if (!mod_fail)
255255 return -ENOMEM;
256256 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
7878 if (!sect_attrs)
7979 return -ENOMEM;
8080
81− gattr = kzalloc_objs(*gattr, nloaded + 1, GFP_KERNEL);
81+ gattr = kzalloc_objs(*gattr, nloaded + 1);
8282 if (!gattr) {
8383 kfree(sect_attrs);
8484 return -ENOMEM;
@@ -170,7 +170,7 @@ static int add_notes_attrs(struct module *mod, const struct load_info *info) · 85 unmodified lines
170170 if (!notes_attrs)
171171 return -ENOMEM;
172172
173− gattr = kzalloc_objs(*gattr, notes + 1, GFP_KERNEL);
173+ gattr = kzalloc_objs(*gattr, notes + 1);
174174 if (!gattr) {
175175 kfree(notes_attrs);
176176 return -ENOMEM;
kernel/module/tracking.c+1−1
@@ -33,7 +33,7 @@ int try_add_tainted_module(struct module *mod) · 32 unmodified lines
3333 }
3434 }
3535
36− mod_taint = kmalloc_obj(*mod_taint, GFP_KERNEL);
36+ mod_taint = kmalloc_obj(*mod_taint);
3737 if (unlikely(!mod_taint))
3838 return -ENOMEM;
3939 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