Hi Daniel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    
https://github.com/intel-lab-lkp/linux/commits/Daniel-Jurgens/virtio-pci-Expose-generic-device-capability-operations/20250828-024128
base:   net-next/main
patch link:    
https://lore.kernel.org/r/20250827183852.2471-6-danielj%40nvidia.com
patch subject: [PATCH net-next 05/11] virtio_net: Create a FF group for ethtool 
steering
config: x86_64-randconfig-121-20250828 
(https://download.01.org/0day-ci/archive/20250829/202508290458.9qtyic0k-...@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 
87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20250829/202508290458.9qtyic0k-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <l...@intel.com>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202508290458.9qtyic0k-...@intel.com/

sparse warnings: (new ones prefixed by >>)
   drivers/net/virtio_net/virtio_net_ff.c: note: in included file (through 
include/linux/virtio_admin.h):
   include/uapi/linux/virtio_net_ff.h:45:48: sparse: sparse: array of flexible 
structures
>> drivers/net/virtio_net/virtio_net_ff.c:99:13: sparse: sparse: restricted 
>> __le32 degrades to integer
>> drivers/net/virtio_net/virtio_net_ff.c:99:13: sparse: sparse: cast to 
>> restricted __le32
>> drivers/net/virtio_net/virtio_net_ff.c:103:35: sparse: sparse: incorrect 
>> type in assignment (different base types) @@     expected restricted __le32 
>> [usertype] groups_limit @@     got int @@
   drivers/net/virtio_net/virtio_net_ff.c:103:35: sparse:     expected 
restricted __le32 [usertype] groups_limit
   drivers/net/virtio_net/virtio_net_ff.c:103:35: sparse:     got int

vim +99 drivers/net/virtio_net/virtio_net_ff.c

    29  
    30  void virtnet_ff_init(struct virtnet_ff *ff, struct virtio_device *vdev)
    31  {
    32          struct virtio_admin_cmd_query_cap_id_result *cap_id_list 
__free(kfree) = NULL;
    33          size_t ff_mask_size = sizeof(struct 
virtio_net_ff_cap_mask_data) +
    34                                sizeof(struct virtio_net_ff_selector) *
    35                                VIRTIO_NET_FF_MASK_TYPE_MAX;
    36          struct virtio_net_resource_obj_ff_group ethtool_group = {};
    37          struct virtio_net_ff_selector *sel;
    38          int err;
    39          int i;
    40  
    41          cap_id_list = kzalloc(sizeof(*cap_id_list), GFP_KERNEL);
    42          if (!cap_id_list)
    43                  return;
    44  
    45          err = virtio_device_cap_id_list_query(vdev, cap_id_list);
    46          if (err)
    47                  return;
    48  
    49          if (!(VIRTIO_CAP_IN_LIST(cap_id_list,
    50                                   VIRTIO_NET_FF_RESOURCE_CAP) &&
    51                VIRTIO_CAP_IN_LIST(cap_id_list,
    52                                   VIRTIO_NET_FF_SELECTOR_CAP) &&
    53                VIRTIO_CAP_IN_LIST(cap_id_list,
    54                                   VIRTIO_NET_FF_ACTION_CAP)))
    55                  return;
    56  
    57          ff->ff_caps = kzalloc(sizeof(*ff->ff_caps), GFP_KERNEL);
    58          if (!ff->ff_caps)
    59                  return;
    60  
    61          err = virtio_device_cap_get(vdev,
    62                                      VIRTIO_NET_FF_RESOURCE_CAP,
    63                                      ff->ff_caps,
    64                                      sizeof(*ff->ff_caps));
    65  
    66          if (err)
    67                  goto err_ff;
    68  
    69          /* VIRTIO_NET_FF_MASK_TYPE start at 1 */
    70          for (i = 1; i <= VIRTIO_NET_FF_MASK_TYPE_MAX; i++)
    71                  ff_mask_size += get_mask_size(i);
    72  
    73          ff->ff_mask = kzalloc(ff_mask_size, GFP_KERNEL);
    74          if (!ff->ff_mask)
    75                  goto err_ff;
    76  
    77          err = virtio_device_cap_get(vdev,
    78                                      VIRTIO_NET_FF_SELECTOR_CAP,
    79                                      ff->ff_mask,
    80                                      ff_mask_size);
    81  
    82          if (err)
    83                  goto err_ff_mask;
    84  
    85          ff->ff_actions = kzalloc(sizeof(*ff->ff_actions) +
    86                                          VIRTIO_NET_FF_ACTION_MAX,
    87                                          GFP_KERNEL);
    88          if (!ff->ff_actions)
    89                  goto err_ff_mask;
    90  
    91          err = virtio_device_cap_get(vdev,
    92                                      VIRTIO_NET_FF_ACTION_CAP,
    93                                      ff->ff_actions,
    94                                      sizeof(*ff->ff_actions) + 
VIRTIO_NET_FF_ACTION_MAX);
    95  
    96          if (err)
    97                  goto err_ff_action;
    98  
  > 99          if (le32_to_cpu(ff->ff_caps->groups_limit < 
VIRTNET_FF_MAX_GROUPS)) {
   100                  err = -ENOSPC;
   101                  goto err_ff_action;
   102          }
 > 103          ff->ff_caps->groups_limit = VIRTNET_FF_MAX_GROUPS;
   104  
   105          err = virtio_device_cap_set(vdev,
   106                                      VIRTIO_NET_FF_RESOURCE_CAP,
   107                                      ff->ff_caps,
   108                                      sizeof(*ff->ff_caps));
   109          if (err)
   110                  goto err_ff_action;
   111  
   112          ff_mask_size = sizeof(struct virtio_net_ff_cap_mask_data);
   113          sel = &ff->ff_mask->selectors[0];
   114  
   115          for (int i = 0; i < ff->ff_mask->count; i++) {
   116                  ff_mask_size += sizeof(struct virtio_net_ff_selector) + 
sel->length;
   117                  sel = (struct virtio_net_ff_selector *)((u8 *)sel + 
sizeof(*sel) + sel->length);
   118          }
   119  
   120          err = virtio_device_cap_set(vdev,
   121                                      VIRTIO_NET_FF_SELECTOR_CAP,
   122                                      ff->ff_mask,
   123                                      ff_mask_size);
   124          if (err)
   125                  goto err_ff_action;
   126  
   127          err = virtio_device_cap_set(vdev,
   128                                      VIRTIO_NET_FF_ACTION_CAP,
   129                                      ff->ff_actions,
   130                                      sizeof(*ff->ff_actions) + 
VIRTIO_NET_FF_ACTION_MAX);
   131          if (err)
   132                  goto err_ff_action;
   133  
   134          ethtool_group.group_priority = 
cpu_to_le16(VIRTNET_FF_ETHTOOL_GROUP_PRIORITY);
   135  
   136          /* Use priority for the object ID. */
   137          err = virtio_device_object_create(vdev,
   138                                            
VIRTIO_NET_RESOURCE_OBJ_FF_GROUP,
   139                                            
VIRTNET_FF_ETHTOOL_GROUP_PRIORITY,
   140                                            &ethtool_group,
   141                                            sizeof(ethtool_group));
   142          if (err)
   143                  goto err_ff_action;
   144  
   145          ff->vdev = vdev;
   146          ff->ff_supported = true;
   147  
   148          return;
   149  
   150  err_ff_action:
   151          kfree(ff->ff_actions);
   152  err_ff_mask:
   153          kfree(ff->ff_mask);
   154  err_ff:
   155          kfree(ff->ff_caps);
   156  }
   157  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Reply via email to