* [android-goldfish:android-3.18 349/362] drivers/staging/wlan-ng/p80211netdev.c:235:41: sparse: sparse: cast to restricted __le16
@ 2021-05-25 20:11 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-05-25 20:11 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9094 bytes --]
tree: https://android.googlesource.com/kernel/goldfish android-3.18
head: 145dffbee46bf9294a60c79e32c2397b27a6853e
commit: a6cb2a3ff14ca4b576a826eddd79006fcfc9f1b2 [349/362] staging: wlan-ng: add missing byte order conversion
config: x86_64-randconfig-s021-20210525 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
git remote add android-goldfish https://android.googlesource.com/kernel/goldfish
git fetch --no-tags android-goldfish android-3.18
git checkout a6cb2a3ff14ca4b576a826eddd79006fcfc9f1b2
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
drivers/staging/wlan-ng/p80211netdev.c:361:24: sparse: sparse: restricted __be16 degrades to integer
drivers/staging/wlan-ng/p80211netdev.c:372:16: sparse: sparse: restricted __be16 degrades to integer
>> drivers/staging/wlan-ng/p80211netdev.c:235:41: sparse: sparse: cast to restricted __le16
arch/x86/include/asm/bitops.h: Assembler messages:
arch/x86/include/asm/bitops.h:206: Warning: no instruction mnemonic suffix given and no register operands; using default for `bts'
vim +235 drivers/staging/wlan-ng/p80211netdev.c
220
221 /**
222 * p80211_convert_to_ether - conversion from 802.11 frame to ethernet frame
223 * @wlandev: pointer to WLAN device
224 * @skb: pointer to socket buffer
225 *
226 * Returns: 0 if conversion succeeded
227 * CONV_TO_ETHER_FAILED if conversion failed
228 * CONV_TO_ETHER_SKIPPED if frame is ignored
229 */
230 static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
231 {
232 struct p80211_hdr_a3 *hdr;
233
234 hdr = (struct p80211_hdr_a3 *) skb->data;
> 235 if (p80211_rx_typedrop(wlandev, le16_to_cpu(hdr->fc)))
236 return CONV_TO_ETHER_SKIPPED;
237
238 /* perform mcast filtering: allow my local address through but reject
239 * anything else that isn't multicast
240 */
241 if (wlandev->netdev->flags & IFF_ALLMULTI) {
242 if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
243 hdr->a1)) {
244 if (!is_multicast_ether_addr(hdr->a1))
245 return CONV_TO_ETHER_SKIPPED;
246 }
247 }
248
249 if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
250 skb->dev->last_rx = jiffies;
251 wlandev->netdev->stats.rx_packets++;
252 wlandev->netdev->stats.rx_bytes += skb->len;
253 netif_rx_ni(skb);
254 return 0;
255 }
256
257 netdev_dbg(wlandev->netdev, "p80211_convert_to_ether failed.\n");
258 return CONV_TO_ETHER_FAILED;
259 }
260
261 /**
262 * p80211netdev_rx_bh - deferred processing of all received frames
263 *
264 * @arg: pointer to WLAN network device structure (cast to unsigned long)
265 */
266 static void p80211netdev_rx_bh(unsigned long arg)
267 {
268 wlandevice_t *wlandev = (wlandevice_t *) arg;
269 struct sk_buff *skb = NULL;
270 netdevice_t *dev = wlandev->netdev;
271
272 /* Let's empty our our queue */
273 while ((skb = skb_dequeue(&wlandev->nsd_rxq))) {
274 if (wlandev->state == WLAN_DEVICE_OPEN) {
275
276 if (dev->type != ARPHRD_ETHER) {
277 /* RAW frame; we shouldn't convert it */
278 /* XXX Append the Prism Header here instead. */
279
280 /* set up various data fields */
281 skb->dev = dev;
282 skb_reset_mac_header(skb);
283 skb->ip_summed = CHECKSUM_NONE;
284 skb->pkt_type = PACKET_OTHERHOST;
285 skb->protocol = htons(ETH_P_80211_RAW);
286 dev->last_rx = jiffies;
287
288 dev->stats.rx_packets++;
289 dev->stats.rx_bytes += skb->len;
290 netif_rx_ni(skb);
291 continue;
292 } else {
293 if (!p80211_convert_to_ether(wlandev, skb))
294 continue;
295 }
296 }
297 dev_kfree_skb(skb);
298 }
299 }
300
301 /*----------------------------------------------------------------
302 * p80211knetdev_hard_start_xmit
303 *
304 * Linux netdevice method for transmitting a frame.
305 *
306 * Arguments:
307 * skb Linux sk_buff containing the frame.
308 * netdev Linux netdevice.
309 *
310 * Side effects:
311 * If the lower layers report that buffers are full. netdev->tbusy
312 * will be set to prevent higher layers from sending more traffic.
313 *
314 * Note: If this function returns non-zero, higher layers retain
315 * ownership of the skb.
316 *
317 * Returns:
318 * zero on success, non-zero on failure.
319 ----------------------------------------------------------------*/
320 static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
321 netdevice_t *netdev)
322 {
323 int result = 0;
324 int txresult = -1;
325 wlandevice_t *wlandev = netdev->ml_priv;
326 union p80211_hdr p80211_hdr;
327 struct p80211_metawep p80211_wep;
328
329 p80211_wep.data = NULL;
330
331 if (skb == NULL)
332 return NETDEV_TX_OK;
333
334 if (wlandev->state != WLAN_DEVICE_OPEN) {
335 result = 1;
336 goto failed;
337 }
338
339 memset(&p80211_hdr, 0, sizeof(union p80211_hdr));
340 memset(&p80211_wep, 0, sizeof(struct p80211_metawep));
341
342 if (netif_queue_stopped(netdev)) {
343 netdev_dbg(netdev, "called when queue stopped.\n");
344 result = 1;
345 goto failed;
346 }
347
348 netif_stop_queue(netdev);
349
350 /* Check to see that a valid mode is set */
351 switch (wlandev->macmode) {
352 case WLAN_MACMODE_IBSS_STA:
353 case WLAN_MACMODE_ESS_STA:
354 case WLAN_MACMODE_ESS_AP:
355 break;
356 default:
357 /* Mode isn't set yet, just drop the frame
358 * and return success .
359 * TODO: we need a saner way to handle this
360 */
> 361 if (skb->protocol != ETH_P_80211_RAW) {
362 netif_start_queue(wlandev->netdev);
363 netdev_notice(netdev, "Tx attempt prior to association, frame dropped.\n");
364 netdev->stats.tx_dropped++;
365 result = 0;
366 goto failed;
367 }
368 break;
369 }
370
371 /* Check for raw transmits */
372 if (skb->protocol == ETH_P_80211_RAW) {
373 if (!capable(CAP_NET_ADMIN)) {
374 result = 1;
375 goto failed;
376 }
377 /* move the header over */
378 memcpy(&p80211_hdr, skb->data, sizeof(union p80211_hdr));
379 skb_pull(skb, sizeof(union p80211_hdr));
380 } else {
381 if (skb_ether_to_p80211
382 (wlandev, wlandev->ethconv, skb, &p80211_hdr,
383 &p80211_wep) != 0) {
384 /* convert failed */
385 netdev_dbg(netdev, "ether_to_80211(%d) failed.\n",
386 wlandev->ethconv);
387 result = 1;
388 goto failed;
389 }
390 }
391 if (wlandev->txframe == NULL) {
392 result = 1;
393 goto failed;
394 }
395
396 netdev->trans_start = jiffies;
397
398 netdev->stats.tx_packets++;
399 /* count only the packet payload */
400 netdev->stats.tx_bytes += skb->len;
401
402 txresult = wlandev->txframe(wlandev, skb, &p80211_hdr, &p80211_wep);
403
404 if (txresult == 0) {
405 /* success and more buf */
406 /* avail, re: hw_txdata */
407 netif_wake_queue(wlandev->netdev);
408 result = NETDEV_TX_OK;
409 } else if (txresult == 1) {
410 /* success, no more avail */
411 netdev_dbg(netdev, "txframe success, no more bufs\n");
412 /* netdev->tbusy = 1; don't set here, irqhdlr */
413 /* may have already cleared it */
414 result = NETDEV_TX_OK;
415 } else if (txresult == 2) {
416 /* alloc failure, drop frame */
417 netdev_dbg(netdev, "txframe returned alloc_fail\n");
418 result = NETDEV_TX_BUSY;
419 } else {
420 /* buffer full or queue busy, drop frame. */
421 netdev_dbg(netdev, "txframe returned full or busy\n");
422 result = NETDEV_TX_BUSY;
423 }
424
425 failed:
426 /* Free up the WEP buffer if it's not the same as the skb */
427 if ((p80211_wep.data) && (p80211_wep.data != skb->data))
428 kzfree(p80211_wep.data);
429
430 /* we always free the skb here, never in a lower level. */
431 if (!result)
432 dev_kfree_skb(skb);
433
434 return result;
435 }
436
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 28704 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [android-goldfish:android-3.18 349/362] drivers/staging/wlan-ng/p80211netdev.c:235:41: sparse: sparse: cast to restricted __le16
@ 2021-07-02 19:16 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-07-02 19:16 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9182 bytes --]
tree: https://android.googlesource.com/kernel/goldfish android-3.18
head: 145dffbee46bf9294a60c79e32c2397b27a6853e
commit: a6cb2a3ff14ca4b576a826eddd79006fcfc9f1b2 [349/362] staging: wlan-ng: add missing byte order conversion
config: x86_64-randconfig-s022-20210630 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
git remote add android-goldfish https://android.googlesource.com/kernel/goldfish
git fetch --no-tags android-goldfish android-3.18
git checkout a6cb2a3ff14ca4b576a826eddd79006fcfc9f1b2
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash LDFLAGS=-z max-page-size=0x200000 drivers/staging/wlan-ng/ lib/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
drivers/staging/wlan-ng/p80211netdev.c:361:24: sparse: sparse: restricted __be16 degrades to integer
drivers/staging/wlan-ng/p80211netdev.c:372:16: sparse: sparse: restricted __be16 degrades to integer
>> drivers/staging/wlan-ng/p80211netdev.c:235:41: sparse: sparse: cast to restricted __le16
arch/x86/include/asm/bitops.h: Assembler messages:
arch/x86/include/asm/bitops.h:206: Warning: no instruction mnemonic suffix given and no register operands; using default for `bts'
vim +235 drivers/staging/wlan-ng/p80211netdev.c
220
221 /**
222 * p80211_convert_to_ether - conversion from 802.11 frame to ethernet frame
223 * @wlandev: pointer to WLAN device
224 * @skb: pointer to socket buffer
225 *
226 * Returns: 0 if conversion succeeded
227 * CONV_TO_ETHER_FAILED if conversion failed
228 * CONV_TO_ETHER_SKIPPED if frame is ignored
229 */
230 static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
231 {
232 struct p80211_hdr_a3 *hdr;
233
234 hdr = (struct p80211_hdr_a3 *) skb->data;
> 235 if (p80211_rx_typedrop(wlandev, le16_to_cpu(hdr->fc)))
236 return CONV_TO_ETHER_SKIPPED;
237
238 /* perform mcast filtering: allow my local address through but reject
239 * anything else that isn't multicast
240 */
241 if (wlandev->netdev->flags & IFF_ALLMULTI) {
242 if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
243 hdr->a1)) {
244 if (!is_multicast_ether_addr(hdr->a1))
245 return CONV_TO_ETHER_SKIPPED;
246 }
247 }
248
249 if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
250 skb->dev->last_rx = jiffies;
251 wlandev->netdev->stats.rx_packets++;
252 wlandev->netdev->stats.rx_bytes += skb->len;
253 netif_rx_ni(skb);
254 return 0;
255 }
256
257 netdev_dbg(wlandev->netdev, "p80211_convert_to_ether failed.\n");
258 return CONV_TO_ETHER_FAILED;
259 }
260
261 /**
262 * p80211netdev_rx_bh - deferred processing of all received frames
263 *
264 * @arg: pointer to WLAN network device structure (cast to unsigned long)
265 */
266 static void p80211netdev_rx_bh(unsigned long arg)
267 {
268 wlandevice_t *wlandev = (wlandevice_t *) arg;
269 struct sk_buff *skb = NULL;
270 netdevice_t *dev = wlandev->netdev;
271
272 /* Let's empty our our queue */
273 while ((skb = skb_dequeue(&wlandev->nsd_rxq))) {
274 if (wlandev->state == WLAN_DEVICE_OPEN) {
275
276 if (dev->type != ARPHRD_ETHER) {
277 /* RAW frame; we shouldn't convert it */
278 /* XXX Append the Prism Header here instead. */
279
280 /* set up various data fields */
281 skb->dev = dev;
282 skb_reset_mac_header(skb);
283 skb->ip_summed = CHECKSUM_NONE;
284 skb->pkt_type = PACKET_OTHERHOST;
285 skb->protocol = htons(ETH_P_80211_RAW);
286 dev->last_rx = jiffies;
287
288 dev->stats.rx_packets++;
289 dev->stats.rx_bytes += skb->len;
290 netif_rx_ni(skb);
291 continue;
292 } else {
293 if (!p80211_convert_to_ether(wlandev, skb))
294 continue;
295 }
296 }
297 dev_kfree_skb(skb);
298 }
299 }
300
301 /*----------------------------------------------------------------
302 * p80211knetdev_hard_start_xmit
303 *
304 * Linux netdevice method for transmitting a frame.
305 *
306 * Arguments:
307 * skb Linux sk_buff containing the frame.
308 * netdev Linux netdevice.
309 *
310 * Side effects:
311 * If the lower layers report that buffers are full. netdev->tbusy
312 * will be set to prevent higher layers from sending more traffic.
313 *
314 * Note: If this function returns non-zero, higher layers retain
315 * ownership of the skb.
316 *
317 * Returns:
318 * zero on success, non-zero on failure.
319 ----------------------------------------------------------------*/
320 static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
321 netdevice_t *netdev)
322 {
323 int result = 0;
324 int txresult = -1;
325 wlandevice_t *wlandev = netdev->ml_priv;
326 union p80211_hdr p80211_hdr;
327 struct p80211_metawep p80211_wep;
328
329 p80211_wep.data = NULL;
330
331 if (skb == NULL)
332 return NETDEV_TX_OK;
333
334 if (wlandev->state != WLAN_DEVICE_OPEN) {
335 result = 1;
336 goto failed;
337 }
338
339 memset(&p80211_hdr, 0, sizeof(union p80211_hdr));
340 memset(&p80211_wep, 0, sizeof(struct p80211_metawep));
341
342 if (netif_queue_stopped(netdev)) {
343 netdev_dbg(netdev, "called when queue stopped.\n");
344 result = 1;
345 goto failed;
346 }
347
348 netif_stop_queue(netdev);
349
350 /* Check to see that a valid mode is set */
351 switch (wlandev->macmode) {
352 case WLAN_MACMODE_IBSS_STA:
353 case WLAN_MACMODE_ESS_STA:
354 case WLAN_MACMODE_ESS_AP:
355 break;
356 default:
357 /* Mode isn't set yet, just drop the frame
358 * and return success .
359 * TODO: we need a saner way to handle this
360 */
> 361 if (skb->protocol != ETH_P_80211_RAW) {
362 netif_start_queue(wlandev->netdev);
363 netdev_notice(netdev, "Tx attempt prior to association, frame dropped.\n");
364 netdev->stats.tx_dropped++;
365 result = 0;
366 goto failed;
367 }
368 break;
369 }
370
371 /* Check for raw transmits */
372 if (skb->protocol == ETH_P_80211_RAW) {
373 if (!capable(CAP_NET_ADMIN)) {
374 result = 1;
375 goto failed;
376 }
377 /* move the header over */
378 memcpy(&p80211_hdr, skb->data, sizeof(union p80211_hdr));
379 skb_pull(skb, sizeof(union p80211_hdr));
380 } else {
381 if (skb_ether_to_p80211
382 (wlandev, wlandev->ethconv, skb, &p80211_hdr,
383 &p80211_wep) != 0) {
384 /* convert failed */
385 netdev_dbg(netdev, "ether_to_80211(%d) failed.\n",
386 wlandev->ethconv);
387 result = 1;
388 goto failed;
389 }
390 }
391 if (wlandev->txframe == NULL) {
392 result = 1;
393 goto failed;
394 }
395
396 netdev->trans_start = jiffies;
397
398 netdev->stats.tx_packets++;
399 /* count only the packet payload */
400 netdev->stats.tx_bytes += skb->len;
401
402 txresult = wlandev->txframe(wlandev, skb, &p80211_hdr, &p80211_wep);
403
404 if (txresult == 0) {
405 /* success and more buf */
406 /* avail, re: hw_txdata */
407 netif_wake_queue(wlandev->netdev);
408 result = NETDEV_TX_OK;
409 } else if (txresult == 1) {
410 /* success, no more avail */
411 netdev_dbg(netdev, "txframe success, no more bufs\n");
412 /* netdev->tbusy = 1; don't set here, irqhdlr */
413 /* may have already cleared it */
414 result = NETDEV_TX_OK;
415 } else if (txresult == 2) {
416 /* alloc failure, drop frame */
417 netdev_dbg(netdev, "txframe returned alloc_fail\n");
418 result = NETDEV_TX_BUSY;
419 } else {
420 /* buffer full or queue busy, drop frame. */
421 netdev_dbg(netdev, "txframe returned full or busy\n");
422 result = NETDEV_TX_BUSY;
423 }
424
425 failed:
426 /* Free up the WEP buffer if it's not the same as the skb */
427 if ((p80211_wep.data) && (p80211_wep.data != skb->data))
428 kzfree(p80211_wep.data);
429
430 /* we always free the skb here, never in a lower level. */
431 if (!result)
432 dev_kfree_skb(skb);
433
434 return result;
435 }
436
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25379 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [android-goldfish:android-3.18 349/362] drivers/staging/wlan-ng/p80211netdev.c:235:41: sparse: sparse: cast to restricted __le16
@ 2021-03-27 16:19 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-03-27 16:19 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9090 bytes --]
tree: https://android.googlesource.com/kernel/goldfish android-3.18
head: 145dffbee46bf9294a60c79e32c2397b27a6853e
commit: a6cb2a3ff14ca4b576a826eddd79006fcfc9f1b2 [349/362] staging: wlan-ng: add missing byte order conversion
config: x86_64-randconfig-s021-20210326 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-277-gc089cd2d-dirty
git remote add android-goldfish https://android.googlesource.com/kernel/goldfish
git fetch --no-tags android-goldfish android-3.18
git checkout a6cb2a3ff14ca4b576a826eddd79006fcfc9f1b2
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
drivers/staging/wlan-ng/p80211netdev.c:361:24: sparse: sparse: restricted __be16 degrades to integer
drivers/staging/wlan-ng/p80211netdev.c:372:16: sparse: sparse: restricted __be16 degrades to integer
>> drivers/staging/wlan-ng/p80211netdev.c:235:41: sparse: sparse: cast to restricted __le16
arch/x86/include/asm/bitops.h: Assembler messages:
arch/x86/include/asm/bitops.h:206: Warning: no instruction mnemonic suffix given and no register operands; using default for `bts'
vim +235 drivers/staging/wlan-ng/p80211netdev.c
220
221 /**
222 * p80211_convert_to_ether - conversion from 802.11 frame to ethernet frame
223 * @wlandev: pointer to WLAN device
224 * @skb: pointer to socket buffer
225 *
226 * Returns: 0 if conversion succeeded
227 * CONV_TO_ETHER_FAILED if conversion failed
228 * CONV_TO_ETHER_SKIPPED if frame is ignored
229 */
230 static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
231 {
232 struct p80211_hdr_a3 *hdr;
233
234 hdr = (struct p80211_hdr_a3 *) skb->data;
> 235 if (p80211_rx_typedrop(wlandev, le16_to_cpu(hdr->fc)))
236 return CONV_TO_ETHER_SKIPPED;
237
238 /* perform mcast filtering: allow my local address through but reject
239 * anything else that isn't multicast
240 */
241 if (wlandev->netdev->flags & IFF_ALLMULTI) {
242 if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
243 hdr->a1)) {
244 if (!is_multicast_ether_addr(hdr->a1))
245 return CONV_TO_ETHER_SKIPPED;
246 }
247 }
248
249 if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
250 skb->dev->last_rx = jiffies;
251 wlandev->netdev->stats.rx_packets++;
252 wlandev->netdev->stats.rx_bytes += skb->len;
253 netif_rx_ni(skb);
254 return 0;
255 }
256
257 netdev_dbg(wlandev->netdev, "p80211_convert_to_ether failed.\n");
258 return CONV_TO_ETHER_FAILED;
259 }
260
261 /**
262 * p80211netdev_rx_bh - deferred processing of all received frames
263 *
264 * @arg: pointer to WLAN network device structure (cast to unsigned long)
265 */
266 static void p80211netdev_rx_bh(unsigned long arg)
267 {
268 wlandevice_t *wlandev = (wlandevice_t *) arg;
269 struct sk_buff *skb = NULL;
270 netdevice_t *dev = wlandev->netdev;
271
272 /* Let's empty our our queue */
273 while ((skb = skb_dequeue(&wlandev->nsd_rxq))) {
274 if (wlandev->state == WLAN_DEVICE_OPEN) {
275
276 if (dev->type != ARPHRD_ETHER) {
277 /* RAW frame; we shouldn't convert it */
278 /* XXX Append the Prism Header here instead. */
279
280 /* set up various data fields */
281 skb->dev = dev;
282 skb_reset_mac_header(skb);
283 skb->ip_summed = CHECKSUM_NONE;
284 skb->pkt_type = PACKET_OTHERHOST;
285 skb->protocol = htons(ETH_P_80211_RAW);
286 dev->last_rx = jiffies;
287
288 dev->stats.rx_packets++;
289 dev->stats.rx_bytes += skb->len;
290 netif_rx_ni(skb);
291 continue;
292 } else {
293 if (!p80211_convert_to_ether(wlandev, skb))
294 continue;
295 }
296 }
297 dev_kfree_skb(skb);
298 }
299 }
300
301 /*----------------------------------------------------------------
302 * p80211knetdev_hard_start_xmit
303 *
304 * Linux netdevice method for transmitting a frame.
305 *
306 * Arguments:
307 * skb Linux sk_buff containing the frame.
308 * netdev Linux netdevice.
309 *
310 * Side effects:
311 * If the lower layers report that buffers are full. netdev->tbusy
312 * will be set to prevent higher layers from sending more traffic.
313 *
314 * Note: If this function returns non-zero, higher layers retain
315 * ownership of the skb.
316 *
317 * Returns:
318 * zero on success, non-zero on failure.
319 ----------------------------------------------------------------*/
320 static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
321 netdevice_t *netdev)
322 {
323 int result = 0;
324 int txresult = -1;
325 wlandevice_t *wlandev = netdev->ml_priv;
326 union p80211_hdr p80211_hdr;
327 struct p80211_metawep p80211_wep;
328
329 p80211_wep.data = NULL;
330
331 if (skb == NULL)
332 return NETDEV_TX_OK;
333
334 if (wlandev->state != WLAN_DEVICE_OPEN) {
335 result = 1;
336 goto failed;
337 }
338
339 memset(&p80211_hdr, 0, sizeof(union p80211_hdr));
340 memset(&p80211_wep, 0, sizeof(struct p80211_metawep));
341
342 if (netif_queue_stopped(netdev)) {
343 netdev_dbg(netdev, "called when queue stopped.\n");
344 result = 1;
345 goto failed;
346 }
347
348 netif_stop_queue(netdev);
349
350 /* Check to see that a valid mode is set */
351 switch (wlandev->macmode) {
352 case WLAN_MACMODE_IBSS_STA:
353 case WLAN_MACMODE_ESS_STA:
354 case WLAN_MACMODE_ESS_AP:
355 break;
356 default:
357 /* Mode isn't set yet, just drop the frame
358 * and return success .
359 * TODO: we need a saner way to handle this
360 */
> 361 if (skb->protocol != ETH_P_80211_RAW) {
362 netif_start_queue(wlandev->netdev);
363 netdev_notice(netdev, "Tx attempt prior to association, frame dropped.\n");
364 netdev->stats.tx_dropped++;
365 result = 0;
366 goto failed;
367 }
368 break;
369 }
370
371 /* Check for raw transmits */
372 if (skb->protocol == ETH_P_80211_RAW) {
373 if (!capable(CAP_NET_ADMIN)) {
374 result = 1;
375 goto failed;
376 }
377 /* move the header over */
378 memcpy(&p80211_hdr, skb->data, sizeof(union p80211_hdr));
379 skb_pull(skb, sizeof(union p80211_hdr));
380 } else {
381 if (skb_ether_to_p80211
382 (wlandev, wlandev->ethconv, skb, &p80211_hdr,
383 &p80211_wep) != 0) {
384 /* convert failed */
385 netdev_dbg(netdev, "ether_to_80211(%d) failed.\n",
386 wlandev->ethconv);
387 result = 1;
388 goto failed;
389 }
390 }
391 if (wlandev->txframe == NULL) {
392 result = 1;
393 goto failed;
394 }
395
396 netdev->trans_start = jiffies;
397
398 netdev->stats.tx_packets++;
399 /* count only the packet payload */
400 netdev->stats.tx_bytes += skb->len;
401
402 txresult = wlandev->txframe(wlandev, skb, &p80211_hdr, &p80211_wep);
403
404 if (txresult == 0) {
405 /* success and more buf */
406 /* avail, re: hw_txdata */
407 netif_wake_queue(wlandev->netdev);
408 result = NETDEV_TX_OK;
409 } else if (txresult == 1) {
410 /* success, no more avail */
411 netdev_dbg(netdev, "txframe success, no more bufs\n");
412 /* netdev->tbusy = 1; don't set here, irqhdlr */
413 /* may have already cleared it */
414 result = NETDEV_TX_OK;
415 } else if (txresult == 2) {
416 /* alloc failure, drop frame */
417 netdev_dbg(netdev, "txframe returned alloc_fail\n");
418 result = NETDEV_TX_BUSY;
419 } else {
420 /* buffer full or queue busy, drop frame. */
421 netdev_dbg(netdev, "txframe returned full or busy\n");
422 result = NETDEV_TX_BUSY;
423 }
424
425 failed:
426 /* Free up the WEP buffer if it's not the same as the skb */
427 if ((p80211_wep.data) && (p80211_wep.data != skb->data))
428 kzfree(p80211_wep.data);
429
430 /* we always free the skb here, never in a lower level. */
431 if (!result)
432 dev_kfree_skb(skb);
433
434 return result;
435 }
436
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 21911 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [android-goldfish:android-3.18 349/362] drivers/staging/wlan-ng/p80211netdev.c:235:41: sparse: sparse: cast to restricted __le16
@ 2020-12-30 16:19 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-12-30 16:19 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3136 bytes --]
tree: https://android.googlesource.com/kernel/goldfish android-3.18
head: 145dffbee46bf9294a60c79e32c2397b27a6853e
commit: a6cb2a3ff14ca4b576a826eddd79006fcfc9f1b2 [349/362] staging: wlan-ng: add missing byte order conversion
config: x86_64-randconfig-s021-20201230 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-184-g1b896707-dirty
git remote add android-goldfish https://android.googlesource.com/kernel/goldfish
git fetch --no-tags android-goldfish android-3.18
git checkout a6cb2a3ff14ca4b576a826eddd79006fcfc9f1b2
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"sparse warnings: (new ones prefixed by >>)"
drivers/staging/wlan-ng/p80211netdev.c:361:24: sparse: sparse: restricted __be16 degrades to integer
drivers/staging/wlan-ng/p80211netdev.c:372:16: sparse: sparse: restricted __be16 degrades to integer
>> drivers/staging/wlan-ng/p80211netdev.c:235:41: sparse: sparse: cast to restricted __le16
arch/x86/include/asm/bitops.h: Assembler messages:
arch/x86/include/asm/bitops.h:206: Warning: no instruction mnemonic suffix given and no register operands; using default for `bts'
vim +235 drivers/staging/wlan-ng/p80211netdev.c
220
221 /**
222 * p80211_convert_to_ether - conversion from 802.11 frame to ethernet frame
223 * @wlandev: pointer to WLAN device
224 * @skb: pointer to socket buffer
225 *
226 * Returns: 0 if conversion succeeded
227 * CONV_TO_ETHER_FAILED if conversion failed
228 * CONV_TO_ETHER_SKIPPED if frame is ignored
229 */
230 static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
231 {
232 struct p80211_hdr_a3 *hdr;
233
234 hdr = (struct p80211_hdr_a3 *) skb->data;
> 235 if (p80211_rx_typedrop(wlandev, le16_to_cpu(hdr->fc)))
236 return CONV_TO_ETHER_SKIPPED;
237
238 /* perform mcast filtering: allow my local address through but reject
239 * anything else that isn't multicast
240 */
241 if (wlandev->netdev->flags & IFF_ALLMULTI) {
242 if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
243 hdr->a1)) {
244 if (!is_multicast_ether_addr(hdr->a1))
245 return CONV_TO_ETHER_SKIPPED;
246 }
247 }
248
249 if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
250 skb->dev->last_rx = jiffies;
251 wlandev->netdev->stats.rx_packets++;
252 wlandev->netdev->stats.rx_bytes += skb->len;
253 netif_rx_ni(skb);
254 return 0;
255 }
256
257 netdev_dbg(wlandev->netdev, "p80211_convert_to_ether failed.\n");
258 return CONV_TO_ETHER_FAILED;
259 }
260
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 23859 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [android-goldfish:android-3.18 349/362] drivers/staging/wlan-ng/p80211netdev.c:235:41: sparse: sparse: cast to restricted __le16
@ 2020-11-15 20:08 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-11-15 20:08 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3449 bytes --]
tree: https://android.googlesource.com/kernel/goldfish android-3.18
head: 145dffbee46bf9294a60c79e32c2397b27a6853e
commit: a6cb2a3ff14ca4b576a826eddd79006fcfc9f1b2 [349/362] staging: wlan-ng: add missing byte order conversion
config: x86_64-randconfig-s021-20201103 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-107-gaf3512a6-dirty
git remote add android-goldfish https://android.googlesource.com/kernel/goldfish
git fetch --no-tags android-goldfish android-3.18
git checkout a6cb2a3ff14ca4b576a826eddd79006fcfc9f1b2
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"sparse warnings: (new ones prefixed by >>)"
drivers/staging/wlan-ng/p80211netdev.c:361:24: sparse: sparse: restricted __be16 degrades to integer
drivers/staging/wlan-ng/p80211netdev.c:372:16: sparse: sparse: restricted __be16 degrades to integer
>> drivers/staging/wlan-ng/p80211netdev.c:235:41: sparse: sparse: cast to restricted __le16
In file included from drivers/staging/wlan-ng/p80211netdev.c:54:0:
include/linux/sched.h:1067:42: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const struct sched_group_energy * const(*sched_domain_energy_f)(int cpu);
^
arch/x86/include/asm/bitops.h: Assembler messages:
arch/x86/include/asm/bitops.h:211: Warning: no instruction mnemonic suffix given and no register operands; using default for `bts'
vim +235 drivers/staging/wlan-ng/p80211netdev.c
220
221 /**
222 * p80211_convert_to_ether - conversion from 802.11 frame to ethernet frame
223 * @wlandev: pointer to WLAN device
224 * @skb: pointer to socket buffer
225 *
226 * Returns: 0 if conversion succeeded
227 * CONV_TO_ETHER_FAILED if conversion failed
228 * CONV_TO_ETHER_SKIPPED if frame is ignored
229 */
230 static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
231 {
232 struct p80211_hdr_a3 *hdr;
233
234 hdr = (struct p80211_hdr_a3 *) skb->data;
> 235 if (p80211_rx_typedrop(wlandev, le16_to_cpu(hdr->fc)))
236 return CONV_TO_ETHER_SKIPPED;
237
238 /* perform mcast filtering: allow my local address through but reject
239 * anything else that isn't multicast
240 */
241 if (wlandev->netdev->flags & IFF_ALLMULTI) {
242 if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
243 hdr->a1)) {
244 if (!is_multicast_ether_addr(hdr->a1))
245 return CONV_TO_ETHER_SKIPPED;
246 }
247 }
248
249 if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
250 skb->dev->last_rx = jiffies;
251 wlandev->netdev->stats.rx_packets++;
252 wlandev->netdev->stats.rx_bytes += skb->len;
253 netif_rx_ni(skb);
254 return 0;
255 }
256
257 netdev_dbg(wlandev->netdev, "p80211_convert_to_ether failed.\n");
258 return CONV_TO_ETHER_FAILED;
259 }
260
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27525 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-02 19:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 20:11 [android-goldfish:android-3.18 349/362] drivers/staging/wlan-ng/p80211netdev.c:235:41: sparse: sparse: cast to restricted __le16 kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2021-07-02 19:16 kernel test robot
2021-03-27 16:19 kernel test robot
2020-12-30 16:19 kernel test robot
2020-11-15 20:08 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.