[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-xen staging-4.19] checkpatch: add qemu_bh_new/aio_bh_new checks



commit db56206f785909aa830e2a19336bb12abca50e82
Author:     Alexander Bulekov <alxndr@xxxxxx>
AuthorDate: Thu Apr 27 17:10:08 2023 -0400
Commit:     Michael Tokarev <mjt@xxxxxxxxxx>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    checkpatch: add qemu_bh_new/aio_bh_new checks
    
    Advise authors to use the _guarded versions of the APIs, instead.
    
    Signed-off-by: Alexander Bulekov <alxndr@xxxxxx>
    Reviewed-by: Darren Kenny <darren.kenny@xxxxxxxxxx>
    Message-Id: <20230427211013.2994127-4-alxndr@xxxxxx>
    Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>
    (cherry picked from commit ef56ffbdd6b0605dc1e305611287b948c970e236)
    Signed-off-by: Michael Tokarev <mjt@xxxxxxxxxx>
---
 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d768171dcf..eeaec436eb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2865,6 +2865,14 @@ sub process {
                if ($line =~ /\bsignal\s*\(/ && !($line =~ /SIG_(?:IGN|DFL)/)) {
                        ERROR("use sigaction to establish signal handlers; 
signal is not portable\n" . $herecurr);
                }
+# recommend qemu_bh_new_guarded instead of qemu_bh_new
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\bqemu_bh_new\s*\(/) {
+                       ERROR("use qemu_bh_new_guarded() instead of 
qemu_bh_new() to avoid reentrancy problems\n" . $herecurr);
+               }
+# recommend aio_bh_new_guarded instead of aio_bh_new
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\baio_bh_new\s*\(/) {
+                       ERROR("use aio_bh_new_guarded() instead of aio_bh_new() 
to avoid reentrancy problems\n" . $herecurr);
+               }
 # check for module_init(), use category-specific init macros explicitly please
                if ($line =~ /^module_init\s*\(/) {
                        ERROR("please use block_init(), type_init() etc. 
instead of module_init()\n" . $herecurr);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.