CC: [email protected]
CC: [email protected]
BCC: [email protected]
CC: [email protected]
TO: Jason Gunthorpe <[email protected]>
CC: Yi Liu <[email protected]>

tree:   https://github.com/jgunthorpe/linux iommufd
head:   fc388f906088fe5f5f2db6a36931e00124f52042
commit: 80866de54d68bbcdb9a65b74f93d4eba596a6f3d [3/13] iommufd: File 
descriptor, context, kconfig and makefiles
:::::: branch date: 4 weeks ago
:::::: commit date: 4 weeks ago
config: i386-randconfig-c001 
(https://download.01.org/0day-ci/archive/20220417/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
64c045e25b8471bbb572bd29159c294a82a86a25)
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # 
https://github.com/jgunthorpe/linux/commit/80866de54d68bbcdb9a65b74f93d4eba596a6f3d
        git remote add jgunthorpe https://github.com/jgunthorpe/linux
        git fetch --no-tags jgunthorpe iommufd
        git checkout 80866de54d68bbcdb9a65b74f93d4eba596a6f3d
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 
clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   drivers/i2c/i2c-core-base.c:1007:2: note: '?' condition is true
           if (ACPI_COMPANION(&client->dev))
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   drivers/i2c/i2c-core-base.c:1007:2: note: Taking true branch
           if (ACPI_COMPANION(&client->dev))
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/i2c/i2c-core-base.c:1008:32: note: Assuming the condition is false
                   acpi_device_clear_enumerated(ACPI_COMPANION(&client->dev));
                                                ^
   include/linux/acpi.h:43:30: note: expanded from macro 'ACPI_COMPANION'
   #define ACPI_COMPANION(dev)             to_acpi_device_node((dev)->fwnode)
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/acpi/acpi_bus.h:421:3: note: expanded from macro 
'to_acpi_device_node'
                   is_acpi_device_node(__to_acpi_device_node_fwnode) ?     \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-core-base.c:1008:32: note: '?' condition is false
                   acpi_device_clear_enumerated(ACPI_COMPANION(&client->dev));
                                                ^
   include/linux/acpi.h:43:30: note: expanded from macro 'ACPI_COMPANION'
   #define ACPI_COMPANION(dev)             to_acpi_device_node((dev)->fwnode)
                                           ^
   include/acpi/acpi_bus.h:421:3: note: expanded from macro 
'to_acpi_device_node'
                   is_acpi_device_node(__to_acpi_device_node_fwnode) ?     \
                   ^
   drivers/i2c/i2c-core-base.c:1008:32: note: Passing null pointer value via 
1st parameter 'adev'
                   acpi_device_clear_enumerated(ACPI_COMPANION(&client->dev));
                                                ^
   include/linux/acpi.h:43:30: note: expanded from macro 'ACPI_COMPANION'
   #define ACPI_COMPANION(dev)             to_acpi_device_node((dev)->fwnode)
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/acpi/acpi_bus.h:418:2: note: expanded from macro 
'to_acpi_device_node'
           ({                                                              \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-core-base.c:1008:3: note: Calling 
'acpi_device_clear_enumerated'
                   acpi_device_clear_enumerated(ACPI_COMPANION(&client->dev));
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/acpi.h:704:22: note: Dereference of null pointer
           adev->flags.visited = false;
           ~~~~~~~~~~~~~~~~~~~~^~~~~~~
   2 warnings generated.
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   4 warnings generated.
   drivers/char/tpm/eventlog/tpm1.c:276:2: warning: Value stored to 'len' is 
never read [clang-analyzer-deadcode.DeadStores]
           len += get_event_name(eventname, event, event_entry);
           ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/char/tpm/eventlog/tpm1.c:276:2: note: Value stored to 'len' is never 
read
           len += get_event_name(eventname, event, event_entry);
           ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 3 warnings (1 in non-user code, 2 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   3 warnings generated.
   drivers/char/tpm/tpm_tis_core.c:423:2: warning: Value stored to 'rc' is 
never read [clang-analyzer-deadcode.DeadStores]
           rc = tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask);
           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/char/tpm/tpm_tis_core.c:423:2: note: Value stored to 'rc' is never 
read
           rc = tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask);
           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   1 warning generated.
>> drivers/iommu/iommufd/main.c:142:7: warning: Use of memory after it is freed 
>> [clang-analyzer-unix.Malloc]
           if (!iommufd_object_destroy_user(ucmd->ictx, obj))
                ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                                
        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   drivers/iommu/iommufd/main.c:138:8: note: Calling 'iommufd_get_object'
           obj = iommufd_get_object(ucmd->ictx, cmd->id, IOMMUFD_OBJ_ANY);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iommu/iommufd/main.c:95:6: note: Assuming 'obj' is non-null
           if (!obj || (type != IOMMUFD_OBJ_ANY && obj->type != type) ||
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                      ^~~~
   drivers/iommu/iommufd/main.c:95:6: note: Left side of '||' is false
           if (!obj || (type != IOMMUFD_OBJ_ANY && obj->type != type) ||
               ^
   drivers/iommu/iommufd/main.c:95:15: note: 'type' is equal to IOMMUFD_OBJ_ANY
           if (!obj || (type != IOMMUFD_OBJ_ANY && obj->type != type) ||
                        ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                      ^~~~
   drivers/iommu/iommufd/main.c:95:39: note: Left side of '&&' is false
           if (!obj || (type != IOMMUFD_OBJ_ANY && obj->type != type) ||
                                                ^
   drivers/iommu/iommufd/main.c:95:2: note: '?' condition is false
           if (!obj || (type != IOMMUFD_OBJ_ANY && obj->type != type) ||
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                 ^
   drivers/iommu/iommufd/main.c:95:7: note: 'obj' is non-null
           if (!obj || (type != IOMMUFD_OBJ_ANY && obj->type != type) ||
                ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                                
        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   drivers/iommu/iommufd/main.c:95:6: note: Left side of '||' is false
           if (!obj || (type != IOMMUFD_OBJ_ANY && obj->type != type) ||
               ^
   drivers/iommu/iommufd/main.c:95:15: note: 'type' is equal to IOMMUFD_OBJ_ANY
           if (!obj || (type != IOMMUFD_OBJ_ANY && obj->type != type) ||
                        ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                                
        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   drivers/iommu/iommufd/main.c:95:39: note: Left side of '&&' is false
           if (!obj || (type != IOMMUFD_OBJ_ANY && obj->type != type) ||
                                                ^
   drivers/iommu/iommufd/main.c:96:6: note: Assuming the condition is false
               !iommufd_lock_obj(obj))
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                                
        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   drivers/iommu/iommufd/main.c:95:2: note: '?' condition is false
           if (!obj || (type != IOMMUFD_OBJ_ANY && obj->type != type) ||
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \

vim +142 drivers/iommu/iommufd/main.c

80866de54d68bb Jason Gunthorpe 2021-11-11  132  
80866de54d68bb Jason Gunthorpe 2021-11-11  133  static int 
iommufd_destroy(struct iommufd_ucmd *ucmd)
80866de54d68bb Jason Gunthorpe 2021-11-11  134  {
80866de54d68bb Jason Gunthorpe 2021-11-11  135          struct iommu_destroy 
*cmd = ucmd->cmd;
80866de54d68bb Jason Gunthorpe 2021-11-11  136          struct iommufd_object 
*obj;
80866de54d68bb Jason Gunthorpe 2021-11-11  137  
80866de54d68bb Jason Gunthorpe 2021-11-11  138          obj = 
iommufd_get_object(ucmd->ictx, cmd->id, IOMMUFD_OBJ_ANY);
80866de54d68bb Jason Gunthorpe 2021-11-11  139          if (IS_ERR(obj))
80866de54d68bb Jason Gunthorpe 2021-11-11  140                  return 
PTR_ERR(obj);
80866de54d68bb Jason Gunthorpe 2021-11-11  141          
iommufd_put_object_keep_user(obj);
80866de54d68bb Jason Gunthorpe 2021-11-11 @142          if 
(!iommufd_object_destroy_user(ucmd->ictx, obj))
80866de54d68bb Jason Gunthorpe 2021-11-11  143                  return -EBUSY;
80866de54d68bb Jason Gunthorpe 2021-11-11  144          return 0;
80866de54d68bb Jason Gunthorpe 2021-11-11  145  }
80866de54d68bb Jason Gunthorpe 2021-11-11  146  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to