| 62aa6f2e | 03-Dec-2024 |
Masahiro Yamada <[email protected]> |
scripts/nsdeps: get 'make nsdeps' working again
Since commit cdd30ebb1b9f ("module: Convert symbol namespace to string literal"), when MODULE_IMPORT_NS() is missing, 'make nsdeps' inserts pointless
scripts/nsdeps: get 'make nsdeps' working again
Since commit cdd30ebb1b9f ("module: Convert symbol namespace to string literal"), when MODULE_IMPORT_NS() is missing, 'make nsdeps' inserts pointless code:
MODULE_IMPORT_NS("ns");
Here, "ns" is not a namespace, but the variable in the semantic patch. It must not be quoted. Instead, a string literal must be passed to Coccinelle.
Fixes: cdd30ebb1b9f ("module: Convert symbol namespace to string literal") Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
show more ...
|
| 4003ba66 | 28-Sep-2024 |
Julia Lawall <[email protected]> |
Reduce Coccinelle choices in string_choices.cocci
The isomorphism neg_if_exp negates the test of a ?: conditional, making it unnecessary to have an explicit case for a negated test with the branches
Reduce Coccinelle choices in string_choices.cocci
The isomorphism neg_if_exp negates the test of a ?: conditional, making it unnecessary to have an explicit case for a negated test with the branches inverted.
At the same time, we can disable neg_if_exp in cases where a different API function may be more suitable for a negated test.
Finally, in the non-patch cases, E matches an expression with parentheses around it, so there is no need to mention () explicitly in the pattern. The () are still needed in the patch cases, because we want to drop them, if they are present.
Signed-off-by: Julia Lawall <[email protected]>
show more ...
|
| f584e375 | 11-Sep-2024 |
Hongbo Li <[email protected]> |
coccinelle: Remove unnecessary parentheses for only one possible change.
The parentheses are only needed if there is a disjunction, ie a set of possible changes. If there is only one pattern, we can
coccinelle: Remove unnecessary parentheses for only one possible change.
The parentheses are only needed if there is a disjunction, ie a set of possible changes. If there is only one pattern, we can remove these parentheses. Just like the format:
- x + y
not:
( - x + y )
Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Julia Lawall <[email protected]>
show more ...
|
| 253244cd | 11-Sep-2024 |
Hongbo Li <[email protected]> |
coccinelle: Add rules to find str_yes_no() replacements
As other rules done, we add rules for str_yes_no() to check the relative opportunities.
Signed-off-by: Hongbo Li <[email protected]> Sign
coccinelle: Add rules to find str_yes_no() replacements
As other rules done, we add rules for str_yes_no() to check the relative opportunities.
Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Julia Lawall <[email protected]>
show more ...
|
| 9b5b4810 | 11-Sep-2024 |
Hongbo Li <[email protected]> |
coccinelle: Add rules to find str_on_off() replacements
As other rules done, we add rules for str_on_off() to check the relative opportunities.
Signed-off-by: Hongbo Li <[email protected]> Sign
coccinelle: Add rules to find str_on_off() replacements
As other rules done, we add rules for str_on_off() to check the relative opportunities.
Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Julia Lawall <[email protected]>
show more ...
|
| c81ca023 | 11-Sep-2024 |
Hongbo Li <[email protected]> |
coccinelle: Add rules to find str_write_read() replacements
As other rules done, we add rules for str_write_read() to check the relative opportunities.
Signed-off-by: Hongbo Li <[email protected]
coccinelle: Add rules to find str_write_read() replacements
As other rules done, we add rules for str_write_read() to check the relative opportunities.
Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Julia Lawall <[email protected]>
show more ...
|
| ba4b514a | 11-Sep-2024 |
Hongbo Li <[email protected]> |
coccinelle: Add rules to find str_read_write() replacements
As other rules done, we add rules for str_read_write() to check the relative opportunities.
Signed-off-by: Hongbo Li <[email protected]
coccinelle: Add rules to find str_read_write() replacements
As other rules done, we add rules for str_read_write() to check the relative opportunities.
Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Julia Lawall <[email protected]>
show more ...
|
| dd2275d3 | 11-Sep-2024 |
Hongbo Li <[email protected]> |
coccinelle: Add rules to find str_enable{d}_disable{d}() replacements
As other rules done, we add rules for str_enable{d}_ disable{d}() to check the relative opportunities.
Signed-off-by: Hongbo Li
coccinelle: Add rules to find str_enable{d}_disable{d}() replacements
As other rules done, we add rules for str_enable{d}_ disable{d}() to check the relative opportunities.
Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Julia Lawall <[email protected]>
show more ...
|
| 5b7ca450 | 11-Sep-2024 |
Hongbo Li <[email protected]> |
coccinelle: Add rules to find str_lo{w}_hi{gh}() replacements
As other rules done, we add rules for str_lo{w}_hi{gh}() to check the relative opportunities.
Signed-off-by: Hongbo Li <lihongbo22@huaw
coccinelle: Add rules to find str_lo{w}_hi{gh}() replacements
As other rules done, we add rules for str_lo{w}_hi{gh}() to check the relative opportunities.
Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Julia Lawall <[email protected]>
show more ...
|
| d4c75440 | 11-Sep-2024 |
Hongbo Li <[email protected]> |
coccinelle: Add rules to find str_hi{gh}_lo{w}() replacements
As other rules done, we add rules for str_hi{gh}_lo{w}() to check the relative opportunities.
Signed-off-by: Hongbo Li <lihongbo22@huaw
coccinelle: Add rules to find str_hi{gh}_lo{w}() replacements
As other rules done, we add rules for str_hi{gh}_lo{w}() to check the relative opportunities.
Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Julia Lawall <[email protected]>
show more ...
|
| 8a0236ba | 11-Sep-2024 |
Hongbo Li <[email protected]> |
coccinelle: Add rules to find str_false_true() replacements
As done with str_true_false(), add checks for str_false_true() opportunities. A simple test can find over 9 cases currently exist in the t
coccinelle: Add rules to find str_false_true() replacements
As done with str_true_false(), add checks for str_false_true() opportunities. A simple test can find over 9 cases currently exist in the tree.
Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Julia Lawall <[email protected]>
show more ...
|
| 0336f898 | 12-Aug-2024 |
Kees Cook <[email protected]> |
coccinelle: Add rules to find str_down_up() replacements
As done with str_up_down(), add checks for str_down_up() opportunities. 5 cases currently exist in the tree.
Suggested-by: Andy Shevchenko <
coccinelle: Add rules to find str_down_up() replacements
As done with str_up_down(), add checks for str_down_up() opportunities. 5 cases currently exist in the tree.
Suggested-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Kees Cook <[email protected]>
show more ...
|
| e7549481 | 27-Feb-2023 |
Jacob Keller <[email protected]> |
coccinelle: semantic patch to check for potential struct_size calls
include/linux/overflow.h includes helper macros intended for calculating sizes of allocations. These macros prevent accidental ove
coccinelle: semantic patch to check for potential struct_size calls
include/linux/overflow.h includes helper macros intended for calculating sizes of allocations. These macros prevent accidental overflow by saturating at SIZE_MAX.
In general when calculating such sizes use of the macros is preferred. Add a semantic patch which can detect code patterns which can be replaced by struct_size.
Note that I set the confidence to medium because this patch doesn't make an attempt to ensure that the relevant array is actually a flexible array. The struct_size macro does specifically require a flexible array. In many cases the detected code could be refactored to a flexible array, but this is not always possible (such as if there are multiple over-allocations).
Signed-off-by: Jacob Keller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
show more ...
|
| ff82e84e | 20-Jan-2024 |
Julia Lawall <[email protected]> |
coccinelle: device_attr_show: simplify patch case
Replacing the final expression argument by ... allows the format string to have multiple arguments.
It also has the advantage of allowing the chang
coccinelle: device_attr_show: simplify patch case
Replacing the final expression argument by ... allows the format string to have multiple arguments.
It also has the advantage of allowing the change to be recognized as a change in a single statement, thus avoiding adding unneeded braces.
Signed-off-by: Julia Lawall <[email protected]>
show more ...
|