soreuseport: fix NULL ptr dereference SO_REUSEPORT after bind
[cascardo/linux.git] / scripts / checkpatch.pl
index 94b4e33..c7bf1aa 100755 (executable)
@@ -5133,7 +5133,8 @@ sub process {
                }x;
                my $all_barriers = qr{
                        (?:$barriers)|
-                       smp_(?:$barrier_stems)
+                       smp_(?:$barrier_stems)|
+                       virt_(?:$barrier_stems)
                }x;
 
                if ($line =~ /\b(?:$all_barriers)\s*\(/) {
@@ -5143,6 +5144,16 @@ sub process {
                        }
                }
 
+               my $underscore_smp_barriers = qr{__smp_(?:$barrier_stems)}x;
+
+               if ($realfile !~ m@^include/asm-generic/@ &&
+                   $realfile !~ m@/barrier\.h$@ &&
+                   $line =~ m/\b(?:$underscore_smp_barriers)\s*\(/ &&
+                   $line !~ m/^.\s*\#\s*define\s+(?:$underscore_smp_barriers)\s*\(/) {
+                       WARN("MEMORY_BARRIER",
+                            "__smp memory barriers shouldn't be used outside barrier.h and asm-generic\n" . $herecurr);
+               }
+
 # check for waitqueue_active without a comment.
                if ($line =~ /\bwaitqueue_active\s*\(/) {
                        if (!ctx_has_comment($first_line, $linenr)) {