-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prep and enable clang-format #118
Conversation
Running this through clang-format results in a massacre. In some cases we get function names starting at column 1, in others, every argument is on separate line. Just block the lot, so things are somewhat sane and consistent. Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
For some arrays, clang-format does far than ideal jobs reformatting. Do so manually and ban clang-format from interfering. Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
For some arrays, clang-format does far than ideal jobs reformatting. Do so manually and ban clang-format from interfering. Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
The .needspawn = false is the default so just remove them. Tall the other tests don't set it, so remove the test-util.c instances. Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
Reformat a bunch of the args blocks and freeze them as-is. The remaining instances clang-format handles correctly. The format is: progname, '--list', 'of', '--arguments', 'modname', NULL Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
For some arrays, clang-format does far than ideal jobs reformatting. Do so manually and ban clang-format from interfering. Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
Import .clang-format from Linux kernel as of v6.11-rc6. Signed-off-by: Lucas De Marchi <[email protected]> Link: #118
- Define our own foreach macros - Add defines for attributes. This also needs the minimum clang-format version to be raised so it has the AttributeMacros setting. - Redefine a few settings related to max number of columns and penalties for breaking lines v2 - [Emil] update attributes list Signed-off-by: Lucas De Marchi <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Link: #118
Ideally the config (and editors) will have hard and soft limit for the line length. Until then, update the config so that clang-format does not excessively reformat. Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
Pushed up to the mass conversion commits. I'd like to postpone those for when we have the #85 fixed to avoid issues with backporting. |
@evelikov can you regenerate the last commits? |
@lucasdemarchi all done |
Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
e74e59f
to
8efbccd
Compare
@@ -1540,12 +1505,12 @@ | |||
* loaded. | |||
*/ | |||
snprintf(line, sizeof(line), "/sys/module/%s", mod->name); | |||
dfd = open(line, O_RDONLY|O_CLOEXEC); | |||
dfd = open(line, O_RDONLY | O_CLOEXEC); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user input (string read by fgets)
|
||
bucket->used--; | ||
hash->count--; | ||
|
||
steps_used = bucket->used / hash->step; | ||
steps_total = bucket->total / hash->step; | ||
if (steps_used + 1 < steps_total) { | ||
size_t size = (steps_used + 1) * | ||
hash->step * sizeof(struct hash_entry); | ||
size_t size = (steps_used + 1) * hash->step * sizeof(struct hash_entry); |
Check failure
Code scanning / CodeQL
Multiplication result converted to larger type High
matches = sscanf(buf, "%s %s %c%u:%u", modname, devname, | ||
&type, &maj, &min); | ||
matches = | ||
sscanf(buf, "%s %s %c%u:%u", modname, devname, &type, &maj, &min); |
Check failure
Code scanning / CodeQL
Unbounded write Critical
string read by fgets
matches = sscanf(buf, "%s %s %c%u:%u", modname, devname, | ||
&type, &maj, &min); | ||
matches = | ||
sscanf(buf, "%s %s %c%u:%u", modname, devname, &type, &maj, &min); |
Check failure
Code scanning / CodeQL
Unbounded write Critical
string read by fgets
Signed-off-by: Emil Velikov <[email protected]> Link: kmod-project#118 Signed-off-by: Lucas De Marchi <[email protected]>
Signed-off-by: Emil Velikov <[email protected]> Link: kmod-project#118 Signed-off-by: Lucas De Marchi <[email protected]>
Signed-off-by: Emil Velikov <[email protected]> Link: kmod-project#118 Signed-off-by: Lucas De Marchi <[email protected]>
Signed-off-by: Emil Velikov <[email protected]> Link: kmod-project#118 Signed-off-by: Lucas De Marchi <[email protected]>
To keep the style consistent. Closes: kmod-project#88 Signed-off-by: Emil Velikov <[email protected]> Link: kmod-project#118 Signed-off-by: Lucas De Marchi <[email protected]>
8efbccd
to
5f6329b
Compare
Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
To keep the style consistent. Closes: #88 Signed-off-by: Emil Velikov <[email protected]> Link: #118 Signed-off-by: Lucas De Marchi <[email protected]>
Applied. |
This series builds on the initial work in #91