[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202006212002.m7TENLZq%lkp@intel.com>
Date: Sun, 21 Jun 2020 20:51:03 +0800
From: kernel test robot <lkp@...el.com>
To: Jose Abreu <Jose.Abreu@...opsys.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1225:18:
sparse: sparse: incorrect type in assignment (different base types)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 64677779e8962c20b580b471790fe42367750599
commit: 4647e021193d638d3c87d1f1b9a5f7f7a48f36a3 net: stmmac: selftests: Add selftest for L3/L4 Filters
date: 10 months ago
config: riscv-randconfig-s031-20200621 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-rc2-13-gc59158c8-dirty
git checkout 4647e021193d638d3c87d1f1b9a5f7f7a48f36a3
# save the attached .config to linux build tree
make W=1 C=1 ARCH=riscv CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:991:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] mask @@ got int @@
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:991:27: sparse: expected restricted __be32 [usertype] mask
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:991:27: sparse: got int
>> drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1225:18: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [addressable] [usertype] src @@ got unsigned int [usertype] src_mask @@
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1225:18: sparse: expected restricted __be32 [addressable] [usertype] src
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1225:18: sparse: got unsigned int [usertype] src_mask
>> drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1226:18: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [addressable] [usertype] dst @@ got unsigned int [usertype] dst_mask @@
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1226:18: sparse: expected restricted __be32 [addressable] [usertype] dst
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1226:18: sparse: got unsigned int [usertype] dst_mask
>> drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1352:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [addressable] [usertype] src @@ got unsigned int [usertype] src_mask @@
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1352:24: sparse: expected restricted __be16 [addressable] [usertype] src
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1352:24: sparse: got unsigned int [usertype] src_mask
>> drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1353:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [addressable] [usertype] dst @@ got unsigned int [usertype] dst_mask @@
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1353:24: sparse: expected restricted __be16 [addressable] [usertype] dst
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1353:24: sparse: got unsigned int [usertype] dst_mask
vim +1225 drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
1170
1171 #ifdef CONFIG_NET_CLS_ACT
1172 static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
1173 u32 dst_mask, u32 src_mask)
1174 {
1175 struct flow_dissector_key_ipv4_addrs key, mask;
1176 unsigned long dummy_cookie = 0xdeadbeef;
1177 struct stmmac_packet_attrs attr = { };
1178 struct flow_dissector *dissector;
1179 struct flow_cls_offload *cls;
1180 struct flow_rule *rule;
1181 int ret;
1182
1183 if (!tc_can_offload(priv->dev))
1184 return -EOPNOTSUPP;
1185 if (!priv->dma_cap.l3l4fnum)
1186 return -EOPNOTSUPP;
1187 if (priv->rss.enable) {
1188 struct stmmac_rss rss = { .enable = false, };
1189
1190 stmmac_rss_configure(priv, priv->hw, &rss,
1191 priv->plat->rx_queues_to_use);
1192 }
1193
1194 dissector = kzalloc(sizeof(*dissector), GFP_KERNEL);
1195 if (!dissector) {
1196 ret = -ENOMEM;
1197 goto cleanup_rss;
1198 }
1199
1200 dissector->used_keys |= (1 << FLOW_DISSECTOR_KEY_IPV4_ADDRS);
1201 dissector->offset[FLOW_DISSECTOR_KEY_IPV4_ADDRS] = 0;
1202
1203 cls = kzalloc(sizeof(*cls), GFP_KERNEL);
1204 if (!cls) {
1205 ret = -ENOMEM;
1206 goto cleanup_dissector;
1207 }
1208
1209 cls->common.chain_index = 0;
1210 cls->command = FLOW_CLS_REPLACE;
1211 cls->cookie = dummy_cookie;
1212
1213 rule = kzalloc(struct_size(rule, action.entries, 1), GFP_KERNEL);
1214 if (!rule) {
1215 ret = -ENOMEM;
1216 goto cleanup_cls;
1217 }
1218
1219 rule->match.dissector = dissector;
1220 rule->match.key = (void *)&key;
1221 rule->match.mask = (void *)&mask;
1222
1223 key.src = htonl(src);
1224 key.dst = htonl(dst);
> 1225 mask.src = src_mask;
> 1226 mask.dst = dst_mask;
1227
1228 cls->rule = rule;
1229
1230 rule->action.entries[0].id = FLOW_ACTION_DROP;
1231 rule->action.num_entries = 1;
1232
1233 attr.dst = priv->dev->dev_addr;
1234 attr.ip_dst = dst;
1235 attr.ip_src = src;
1236
1237 /* Shall receive packet */
1238 ret = __stmmac_test_loopback(priv, &attr);
1239 if (ret)
1240 goto cleanup_rule;
1241
1242 ret = stmmac_tc_setup_cls(priv, priv, cls);
1243 if (ret)
1244 goto cleanup_rule;
1245
1246 /* Shall NOT receive packet */
1247 ret = __stmmac_test_loopback(priv, &attr);
1248 ret = ret ? 0 : -EINVAL;
1249
1250 cls->command = FLOW_CLS_DESTROY;
1251 stmmac_tc_setup_cls(priv, priv, cls);
1252 cleanup_rule:
1253 kfree(rule);
1254 cleanup_cls:
1255 kfree(cls);
1256 cleanup_dissector:
1257 kfree(dissector);
1258 cleanup_rss:
1259 if (priv->rss.enable) {
1260 stmmac_rss_configure(priv, priv->hw, &priv->rss,
1261 priv->plat->rx_queues_to_use);
1262 }
1263
1264 return ret;
1265 }
1266 #else
1267 static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
1268 u32 dst_mask, u32 src_mask)
1269 {
1270 return -EOPNOTSUPP;
1271 }
1272 #endif
1273
1274 static int stmmac_test_l3filt_da(struct stmmac_priv *priv)
1275 {
1276 u32 addr = 0x10203040;
1277
1278 return __stmmac_test_l3filt(priv, addr, 0, ~0, 0);
1279 }
1280
1281 static int stmmac_test_l3filt_sa(struct stmmac_priv *priv)
1282 {
1283 u32 addr = 0x10203040;
1284
1285 return __stmmac_test_l3filt(priv, 0, addr, 0, ~0);
1286 }
1287
1288 #ifdef CONFIG_NET_CLS_ACT
1289 static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
1290 u32 dst_mask, u32 src_mask, bool udp)
1291 {
1292 struct {
1293 struct flow_dissector_key_basic bkey;
1294 struct flow_dissector_key_ports key;
1295 } __aligned(BITS_PER_LONG / 8) keys;
1296 struct {
1297 struct flow_dissector_key_basic bmask;
1298 struct flow_dissector_key_ports mask;
1299 } __aligned(BITS_PER_LONG / 8) masks;
1300 unsigned long dummy_cookie = 0xdeadbeef;
1301 struct stmmac_packet_attrs attr = { };
1302 struct flow_dissector *dissector;
1303 struct flow_cls_offload *cls;
1304 struct flow_rule *rule;
1305 int ret;
1306
1307 if (!tc_can_offload(priv->dev))
1308 return -EOPNOTSUPP;
1309 if (!priv->dma_cap.l3l4fnum)
1310 return -EOPNOTSUPP;
1311 if (priv->rss.enable) {
1312 struct stmmac_rss rss = { .enable = false, };
1313
1314 stmmac_rss_configure(priv, priv->hw, &rss,
1315 priv->plat->rx_queues_to_use);
1316 }
1317
1318 dissector = kzalloc(sizeof(*dissector), GFP_KERNEL);
1319 if (!dissector) {
1320 ret = -ENOMEM;
1321 goto cleanup_rss;
1322 }
1323
1324 dissector->used_keys |= (1 << FLOW_DISSECTOR_KEY_BASIC);
1325 dissector->used_keys |= (1 << FLOW_DISSECTOR_KEY_PORTS);
1326 dissector->offset[FLOW_DISSECTOR_KEY_BASIC] = 0;
1327 dissector->offset[FLOW_DISSECTOR_KEY_PORTS] = offsetof(typeof(keys), key);
1328
1329 cls = kzalloc(sizeof(*cls), GFP_KERNEL);
1330 if (!cls) {
1331 ret = -ENOMEM;
1332 goto cleanup_dissector;
1333 }
1334
1335 cls->common.chain_index = 0;
1336 cls->command = FLOW_CLS_REPLACE;
1337 cls->cookie = dummy_cookie;
1338
1339 rule = kzalloc(struct_size(rule, action.entries, 1), GFP_KERNEL);
1340 if (!rule) {
1341 ret = -ENOMEM;
1342 goto cleanup_cls;
1343 }
1344
1345 rule->match.dissector = dissector;
1346 rule->match.key = (void *)&keys;
1347 rule->match.mask = (void *)&masks;
1348
1349 keys.bkey.ip_proto = udp ? IPPROTO_UDP : IPPROTO_TCP;
1350 keys.key.src = htons(src);
1351 keys.key.dst = htons(dst);
> 1352 masks.mask.src = src_mask;
> 1353 masks.mask.dst = dst_mask;
1354
1355 cls->rule = rule;
1356
1357 rule->action.entries[0].id = FLOW_ACTION_DROP;
1358 rule->action.num_entries = 1;
1359
1360 attr.dst = priv->dev->dev_addr;
1361 attr.tcp = !udp;
1362 attr.sport = src;
1363 attr.dport = dst;
1364 attr.ip_dst = 0;
1365
1366 /* Shall receive packet */
1367 ret = __stmmac_test_loopback(priv, &attr);
1368 if (ret)
1369 goto cleanup_rule;
1370
1371 ret = stmmac_tc_setup_cls(priv, priv, cls);
1372 if (ret)
1373 goto cleanup_rule;
1374
1375 /* Shall NOT receive packet */
1376 ret = __stmmac_test_loopback(priv, &attr);
1377 ret = ret ? 0 : -EINVAL;
1378
1379 cls->command = FLOW_CLS_DESTROY;
1380 stmmac_tc_setup_cls(priv, priv, cls);
1381 cleanup_rule:
1382 kfree(rule);
1383 cleanup_cls:
1384 kfree(cls);
1385 cleanup_dissector:
1386 kfree(dissector);
1387 cleanup_rss:
1388 if (priv->rss.enable) {
1389 stmmac_rss_configure(priv, priv->hw, &priv->rss,
1390 priv->plat->rx_queues_to_use);
1391 }
1392
1393 return ret;
1394 }
1395 #else
1396 static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
1397 u32 dst_mask, u32 src_mask, bool udp)
1398 {
1399 return -EOPNOTSUPP;
1400 }
1401 #endif
1402
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (24762 bytes)
Powered by blists - more mailing lists