aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/checkpatch.pl5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index cb8eff233e..5caa739db4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2850,6 +2850,11 @@ sub process {
WARN("consider using g_path_get_$1() in preference to g_strdup($1())\n" . $herecurr);
}
+# enforce g_memdup2() over g_memdup()
+ if ($line =~ /\bg_memdup\s*\(/) {
+ ERROR("use g_memdup2() instead of unsafe g_memdup()\n" . $herecurr);
+ }
+
# recommend qemu_strto* over strto* for numeric conversions
if ($line =~ /\b(strto[^kd].*?)\s*\(/) {
ERROR("consider using qemu_$1 in preference to $1\n" . $herecurr);