diff options
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 05c99c0b7e6c..1dbd6d1cd1b5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -4087,6 +4087,16 @@ sub process { | |||
4087 | } | 4087 | } |
4088 | } | 4088 | } |
4089 | 4089 | ||
4090 | # Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar) | ||
4091 | if ($^V && $^V ge 5.10.0 && | ||
4092 | $line =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/s) { | ||
4093 | if (WARN("PREFER_ETHER_ADDR_COPY", | ||
4094 | "Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)\n" . $herecurr) && | ||
4095 | $fix) { | ||
4096 | $fixed[$linenr - 1] =~ s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_addr_copy($2, $7)/; | ||
4097 | } | ||
4098 | } | ||
4099 | |||
4090 | # typecasts on min/max could be min_t/max_t | 4100 | # typecasts on min/max could be min_t/max_t |
4091 | if ($^V && $^V ge 5.10.0 && | 4101 | if ($^V && $^V ge 5.10.0 && |
4092 | defined $stat && | 4102 | defined $stat && |