History

module: Fix ERRORs reported by checkpatch.pl

Checkpatch reports following errors: ERROR: do not use assignment in if condition + if ((colon = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) { ERROR: do not use assignment in if condition + if ((mod = find_module_all(name, colon - name, false)) != NULL) ERROR: do not use assignment in if condition + if ((ret = find_kallsyms_symbol_value(mod, name)) != 0) ERROR: do not initialise globals to 0 +int modules_disabled = 0; Fix them. The following one has to remain, because the condition has to be evaluated multiple times by the macro wait_event_interruptible_timeout(). ERROR: do not use assignment in if condition + if (wait_event_interruptible_timeout(module_wq,

Christophe Leroy committed 4 years ago

Commit ecc726f1 parent ae39e9e2 files · +7 −4Browse files

Unified · Split

2 files
  1. kernel/module/kallsyms.c +6 −3
  2. kernel/module/main.c +1 −1
kernel/module/kallsyms.c+6−3
@@ -466,14 +466,17 @@ unsigned long module_kallsyms_lookup_name(const char *name) · 465 unmodified lines
466 466
467 /* Don't lock: we're in enough trouble already. */467 /* Don't lock: we're in enough trouble already. */
468 preempt_disable();468 preempt_disable();
469 if ((colon = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) {469 colon = strnchr(name, MODULE_NAME_LEN, ':');
470 if ((mod = find_module_all(name, colon - name, false)) != NULL)470 if (colon) {
471 mod = find_module_all(name, colon - name, false);
472 if (mod)
471 ret = find_kallsyms_symbol_value(mod, colon + 1);473 ret = find_kallsyms_symbol_value(mod, colon + 1);
472 } else {474 } else {
473 list_for_each_entry_rcu(mod, &modules, list) {475 list_for_each_entry_rcu(mod, &modules, list) {
474 if (mod->state == MODULE_STATE_UNFORMED)476 if (mod->state == MODULE_STATE_UNFORMED)
475 continue;477 continue;
476 if ((ret = find_kallsyms_symbol_value(mod, name)) != 0)478 ret = find_kallsyms_symbol_value(mod, name);
479 if (ret)
477 break;480 break;
478 }481 }
479 }482 }
kernel/module/main.c+1−1
@@ -119,7 +119,7 @@ static void mod_update_bounds(struct module *mod) · 118 unmodified lines
119}119}
120 120
121/* Block module loading/unloading? */121/* Block module loading/unloading? */
122int modules_disabled = 0;122int modules_disabled;
123core_param(nomodule, modules_disabled, bint, 0);123core_param(nomodule, modules_disabled, bint, 0);
124 124
125/* Waiting for a module to finish initializing? */125/* Waiting for a module to finish initializing? */

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