OpenCloudOS-Kernel/scripts/coccinelle/misc
Wen Yang ac5f313624 coccinelle: semantic patch to check for inappropriate do_div() calls
do_div() does a 64-by-32 division.
When the divisor is unsigned long, u64, or s64,
do_div() truncates it to 32 bits, this means it
can test non-zero and be truncated to zero for division.
This semantic patch is inspired by Mateusz Guzik's patch:
commit b0ab99e773 ("sched: Fix possible divide by zero in avg_atom() calculation")

Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>
Cc: Nicolas Palix <nicolas.palix@imag.fr>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: Matthias Maennich <maennich@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: cocci@systeme.lip6.fr
Cc: linux-kernel@vger.kernel.org
2021-09-11 22:57:39 +02:00
..
add_namespace.cocci scripts: add dummy report mode to add_namespace.cocci 2020-07-10 14:19:58 +02:00
array_size.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
array_size_dup.cocci coccinelle: misc: add array_size_dup script to detect missed overflow checks 2020-08-04 22:46:58 +02:00
badty.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
boolconv.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
boolreturn.cocci License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bugon.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
cond_no_effect.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
cstptr.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
do_div.cocci coccinelle: semantic patch to check for inappropriate do_div() calls 2021-09-11 22:57:39 +02:00
doubleinit.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
excluded_middle.cocci coccinelle: misc: add excluded_middle.cocci script 2020-09-21 19:45:46 +02:00
flexible_array.cocci coccinelle: misc: restrict patch mode in flexible_array.cocci 2021-05-01 21:23:56 +02:00
ifaddr.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
ifcol.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
irqf_oneshot.cocci coccinelle: irqf_oneshot: reduce the severity due to false positives 2021-05-01 21:23:57 +02:00
minmax.cocci coccinelle: misc: minmax: suppress patch generation for err returns 2021-05-01 21:27:10 +02:00
newline_in_nl_msg.cocci net: remove newlines in NL_SET_ERR_MSG_MOD 2020-05-07 17:56:14 -07:00
noderef.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
of_table.cocci License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
orplus.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
returnvar.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
semicolon.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
swap.cocci coccinelle: misc: add swap script 2021-05-01 21:23:56 +02:00
uninitialized_var.cocci coccinelle: misc: update uninitialized_var.cocci documentation 2021-05-01 21:23:56 +02:00
warn.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00