From: Dan Carpenter <dan.carpenter@oracle.com>
To: haijun.liu@mediatek.com
Cc: linux-mediatek@lists.infradead.org
Subject: [bug report] net: wwan: t7xx: Add control port
Date: Tue, 17 May 2022 14:49:59 +0300 [thread overview]
Message-ID: <YoOL505vRMBGxX45@kili> (raw)
Hello Haijun Liu,
The patch da45d2566a1d: "net: wwan: t7xx: Add control port" from May
6, 2022, leads to the following Smatch static checker warning:
drivers/net/wwan/t7xx/t7xx_modem_ops.c:499 t7xx_core_hk_handler()
error: potentially dereferencing uninitialized 'event'.
drivers/net/wwan/t7xx/t7xx_modem_ops.c
457 static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_fsm_ctl *ctl,
458 enum t7xx_fsm_event_state event_id,
459 enum t7xx_fsm_event_state err_detect)
460 {
461 struct t7xx_sys_info *core_info = &md->core_md;
462 struct device *dev = &md->t7xx_dev->pdev->dev;
463 struct t7xx_fsm_event *event, *event_next;
^^^^^
464 unsigned long flags;
465 int ret;
466
467 t7xx_prepare_host_rt_data_query(core_info);
468
469 while (!kthread_should_stop()) {
^^^^^^^^^^^^^^^^^^^^^
What about this is true on the first iteration through the loop?
470 bool event_received = false;
471
472 spin_lock_irqsave(&ctl->event_lock, flags);
473 list_for_each_entry_safe(event, event_next, &ctl->event_queue, entry) {
474 if (event->event_id == err_detect) {
475 list_del(&event->entry);
476 spin_unlock_irqrestore(&ctl->event_lock, flags);
477 dev_err(dev, "Core handshake error event received\n");
478 goto err_free_event;
479 } else if (event->event_id == event_id) {
480 list_del(&event->entry);
481 event_received = true;
482 break;
483 }
484 }
485 spin_unlock_irqrestore(&ctl->event_lock, flags);
486
487 if (event_received)
488 break;
489
490 wait_event_interruptible(ctl->event_wq, !list_empty(&ctl->event_queue) ||
491 kthread_should_stop());
492 if (kthread_should_stop())
493 goto err_free_event;
494 }
495
496 if (ctl->exp_flg)
497 goto err_free_event;
^^^^^^^^^^^^^^^^^^^
Uninitialized on this path too.
498
--> 499 ret = t7xx_parse_host_rt_data(ctl, core_info, dev, event->data, event->length);
^^^^^^^
Uninitialized?
500 if (ret) {
501 dev_err(dev, "Host failure parsing runtime data: %d\n", ret);
502 goto err_free_event;
503 }
504
505 if (ctl->exp_flg)
506 goto err_free_event;
507
508 ret = t7xx_prepare_device_rt_data(core_info, dev, event->data);
509 if (ret) {
510 dev_err(dev, "Device failure parsing runtime data: %d", ret);
511 goto err_free_event;
512 }
513
514 core_info->ready = true;
515 core_info->handshake_ongoing = false;
516 wake_up(&ctl->async_hk_wq);
517 err_free_event:
518 kfree(event);
519 }
regards,
dan carpenter
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next reply other threads:[~2022-05-17 11:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 11:49 Dan Carpenter [this message]
[not found] ` <KL1PR03MB58335FE9D2D6595FABD14996E4D19@KL1PR03MB5833.apcprd03.prod.outlook.com>
2022-05-19 15:39 ` [bug report] net: wwan: t7xx: Add control port Martinez, Ricardo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YoOL505vRMBGxX45@kili \
--to=dan.carpenter@oracle.com \
--cc=haijun.liu@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.