Hi Kenneth,

url:    
https://github.com/0day-ci/linux/commits/Kenneth-Lee/A-General-Accelerator-Framework-WarpDrive/20180803-055629

smatch warnings:
drivers/vfio/spimdev/vfio_spimdev.c:86 iommu_type_show() error: 'spimdev' 
dereferencing possible ERR_PTR()
drivers/vfio/spimdev/vfio_spimdev.c:99 dma_flag_show() error: 'spimdev' 
dereferencing possible ERR_PTR()
drivers/vfio/spimdev/vfio_spimdev.c:135 flags_show() error: 'spimdev' 
dereferencing possible ERR_PTR()
drivers/vfio/spimdev/vfio_spimdev.c:136 name_show() error: 'spimdev' 
dereferencing possible ERR_PTR()
drivers/vfio/spimdev/vfio_spimdev.c:138 device_api_show() error: 'spimdev' 
dereferencing possible ERR_PTR()
drivers/vfio/spimdev/vfio_spimdev.c:147 available_instances_show() error: 
'spimdev' dereferencing possible ERR_PTR()
drivers/vfio/spimdev/vfio_spimdev.c:361 vfio_spimdev_register() warn: unsigned 
'spimdev->dev_id' is never less than zero.
drivers/vfio/vfio_iommu_type1.c:1703 vfio_iommu_type1_detach_group() error: 
uninitialized symbol 'ret'.

# 
https://github.com/0day-ci/linux/commit/0f2fc292dab07b0ecbb46bc498cc29a895196a36
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 0f2fc292dab07b0ecbb46bc498cc29a895196a36
vim +/spimdev +86 drivers/vfio/spimdev/vfio_spimdev.c

0f2fc292 Kenneth Lee 2018-08-01   77  
0f2fc292 Kenneth Lee 2018-08-01   78  static ssize_t iommu_type_show(struct 
device *dev,
0f2fc292 Kenneth Lee 2018-08-01   79                           struct 
device_attribute *attr, char *buf)
0f2fc292 Kenneth Lee 2018-08-01   80  {
0f2fc292 Kenneth Lee 2018-08-01   81    struct vfio_spimdev *spimdev = 
vfio_spimdev_pdev_spimdev(dev);
0f2fc292 Kenneth Lee 2018-08-01   82  
0f2fc292 Kenneth Lee 2018-08-01   83    if (!spimdev)
0f2fc292 Kenneth Lee 2018-08-01   84            return -ENODEV;
0f2fc292 Kenneth Lee 2018-08-01   85  
0f2fc292 Kenneth Lee 2018-08-01  @86    return sprintf(buf, "%d\n", 
spimdev->iommu_type);
0f2fc292 Kenneth Lee 2018-08-01   87  }
0f2fc292 Kenneth Lee 2018-08-01   88  
0f2fc292 Kenneth Lee 2018-08-01   89  static DEVICE_ATTR_RO(iommu_type);
0f2fc292 Kenneth Lee 2018-08-01   90  
0f2fc292 Kenneth Lee 2018-08-01   91  static ssize_t dma_flag_show(struct 
device *dev,
0f2fc292 Kenneth Lee 2018-08-01   92                         struct 
device_attribute *attr, char *buf)
0f2fc292 Kenneth Lee 2018-08-01   93  {
0f2fc292 Kenneth Lee 2018-08-01   94    struct vfio_spimdev *spimdev = 
vfio_spimdev_pdev_spimdev(dev);
0f2fc292 Kenneth Lee 2018-08-01   95  
0f2fc292 Kenneth Lee 2018-08-01   96    if (!spimdev)
0f2fc292 Kenneth Lee 2018-08-01   97            return -ENODEV;
0f2fc292 Kenneth Lee 2018-08-01   98  
0f2fc292 Kenneth Lee 2018-08-01  @99    return sprintf(buf, "%d\n", 
spimdev->dma_flag);
0f2fc292 Kenneth Lee 2018-08-01  100  }
0f2fc292 Kenneth Lee 2018-08-01  101  
0f2fc292 Kenneth Lee 2018-08-01  102  static DEVICE_ATTR_RO(dma_flag);
0f2fc292 Kenneth Lee 2018-08-01  103  
0f2fc292 Kenneth Lee 2018-08-01  104  /* mdev->dev_attr_groups */
0f2fc292 Kenneth Lee 2018-08-01  105  static struct attribute 
*vfio_spimdev_attrs[] = {
0f2fc292 Kenneth Lee 2018-08-01  106    &dev_attr_iommu_type.attr,
0f2fc292 Kenneth Lee 2018-08-01  107    &dev_attr_dma_flag.attr,
0f2fc292 Kenneth Lee 2018-08-01  108    NULL,
0f2fc292 Kenneth Lee 2018-08-01  109  };
0f2fc292 Kenneth Lee 2018-08-01  110  static const struct attribute_group 
vfio_spimdev_group = {
0f2fc292 Kenneth Lee 2018-08-01  111    .name  = 
VFIO_SPIMDEV_PDEV_ATTRS_GRP_NAME,
0f2fc292 Kenneth Lee 2018-08-01  112    .attrs = vfio_spimdev_attrs,
0f2fc292 Kenneth Lee 2018-08-01  113  };
0f2fc292 Kenneth Lee 2018-08-01  114  const struct attribute_group 
*vfio_spimdev_groups[] = {
0f2fc292 Kenneth Lee 2018-08-01  115    &vfio_spimdev_group,
0f2fc292 Kenneth Lee 2018-08-01  116    NULL,
0f2fc292 Kenneth Lee 2018-08-01  117  };
0f2fc292 Kenneth Lee 2018-08-01  118  
0f2fc292 Kenneth Lee 2018-08-01  119  /* default attributes for 
mdev->supported_type_groups, used by registerer*/
0f2fc292 Kenneth Lee 2018-08-01  120  #define MDEV_TYPE_ATTR_RO_EXPORT(name) \
0f2fc292 Kenneth Lee 2018-08-01  121            MDEV_TYPE_ATTR_RO(name); \
0f2fc292 Kenneth Lee 2018-08-01  122            
EXPORT_SYMBOL_GPL(mdev_type_attr_##name);
0f2fc292 Kenneth Lee 2018-08-01  123  
0f2fc292 Kenneth Lee 2018-08-01  124  #define DEF_SIMPLE_SPIMDEV_ATTR(_name, 
spimdev_member, format) \
0f2fc292 Kenneth Lee 2018-08-01  125  static ssize_t _name##_show(struct 
kobject *kobj, struct device *dev, \
0f2fc292 Kenneth Lee 2018-08-01  126                        char *buf) \
0f2fc292 Kenneth Lee 2018-08-01  127  { \
0f2fc292 Kenneth Lee 2018-08-01  128    struct vfio_spimdev *spimdev = 
vfio_spimdev_pdev_spimdev(dev); \
0f2fc292 Kenneth Lee 2018-08-01  129    if (!spimdev) \
0f2fc292 Kenneth Lee 2018-08-01  130            return -ENODEV; \
0f2fc292 Kenneth Lee 2018-08-01  131    return sprintf(buf, format, 
spimdev->spimdev_member); \
0f2fc292 Kenneth Lee 2018-08-01  132  } \
0f2fc292 Kenneth Lee 2018-08-01  133  MDEV_TYPE_ATTR_RO_EXPORT(_name)
0f2fc292 Kenneth Lee 2018-08-01  134  
0f2fc292 Kenneth Lee 2018-08-01 @135  DEF_SIMPLE_SPIMDEV_ATTR(flags, flags, 
"%d");
0f2fc292 Kenneth Lee 2018-08-01 @136  DEF_SIMPLE_SPIMDEV_ATTR(name, name, 
"%s"); /* this should be algorithm name, */
0f2fc292 Kenneth Lee 2018-08-01  137            /* but you would not care if 
you have only one algorithm */
0f2fc292 Kenneth Lee 2018-08-01 @138  DEF_SIMPLE_SPIMDEV_ATTR(device_api, 
api_ver, "%s");
0f2fc292 Kenneth Lee 2018-08-01  139  
0f2fc292 Kenneth Lee 2018-08-01  140  /* this return total queue left, not mdev 
left */
0f2fc292 Kenneth Lee 2018-08-01  141  static ssize_t
0f2fc292 Kenneth Lee 2018-08-01  142  available_instances_show(struct kobject 
*kobj, struct device *dev, char *buf)
0f2fc292 Kenneth Lee 2018-08-01  143  {
0f2fc292 Kenneth Lee 2018-08-01  144    struct vfio_spimdev *spimdev = 
vfio_spimdev_pdev_spimdev(dev);
0f2fc292 Kenneth Lee 2018-08-01  145  
0f2fc292 Kenneth Lee 2018-08-01  146    return sprintf(buf, "%d",
0f2fc292 Kenneth Lee 2018-08-01 @147                    
spimdev->ops->get_available_instances(spimdev));
0f2fc292 Kenneth Lee 2018-08-01  148  }
0f2fc292 Kenneth Lee 2018-08-01  149  
MDEV_TYPE_ATTR_RO_EXPORT(available_instances);
0f2fc292 Kenneth Lee 2018-08-01  150  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
_______________________________________________
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild

Reply via email to