Content-Type: multipart/mixed; boundary="===============8579311690870986514==" MIME-Version: 1.0 From: Kalle Valo To: kbuild-all@lists.01.org Subject: Re: [ath6kl:pending-ath11k 316/345] drivers/net/wireless/ath/ath11k/debug.c:575 ath11k_write_simulate_fw_crash() error: we previously assumed 'ar' could be null (see line 549) Date: Fri, 11 Oct 2019 14:44:54 +0300 Message-ID: <87eezjzetl.fsf@kamboji.qca.qualcomm.com> In-Reply-To: <20191011103719.GR13286@kadam> List-Id: --===============8579311690870986514== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable (moving from ath10k to ath11k list) Dan Carpenter writes: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git pen= ding-ath11k > head: 727f4796623292eb33ce560a3e25ba0040d17871 > commit: 75a016fcc8f79a7d650462c69bb28aa886b4f09e [316/345] ath11k: cleanu= p and rename ath11k_send_crash_inject_cmd() > > If you fix the issue, kindly add following tag > Reported-by: kbuild test robot > Reported-by: Dan Carpenter > > New smatch warnings: > drivers/net/wireless/ath/ath11k/debug.c:575 ath11k_write_simulate_fw_cras= h() error: we previously assumed 'ar' could be null (see line 549) > > Old smatch warnings: > drivers/net/wireless/ath/ath11k/debug.c:566 ath11k_write_simulate_fw_cras= h() error: uninitialized symbol 'radioup'. > > # https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?i= d=3D75a016fcc8f79a7d650462c69bb28aa886b4f09e > git remote add ath6kl https://git.kernel.org/pub/scm/linux/kernel/git/kva= lo/ath.git > git remote update ath6kl > git checkout 75a016fcc8f79a7d650462c69bb28aa886b4f09e > vim +/ar +575 drivers/net/wireless/ath/ath11k/debug.c > > 258bbf525e652e Kalle Valo 2019-02-05 535 static ssize_t = ath11k_write_simulate_fw_crash(struct file *file, > 258bbf525e652e Kalle Valo 2019-02-05 536 cons= t char __user *user_buf, > 258bbf525e652e Kalle Valo 2019-02-05 537 size= _t count, loff_t *ppos) > 258bbf525e652e Kalle Valo 2019-02-05 538 { > d25cb35c6f10ac Sathishkumar Muruganandam 2019-02-13 539 struct ath11k_= base *ab =3D file->private_data; > 5cf3588467b76d Pradeep Kumar Chitrapu 2019-03-15 540 struct ath11k_= pdev *pdev; > d25cb35c6f10ac Sathishkumar Muruganandam 2019-02-13 541 struct ath11k = *ar =3D ab->pdevs[0].ar; > 258bbf525e652e Kalle Valo 2019-02-05 542 char buf[32] = =3D {0}; > 258bbf525e652e Kalle Valo 2019-02-05 543 ssize_t rc; > 5cf3588467b76d Pradeep Kumar Chitrapu 2019-03-15 544 int i, ret, ra= dioup; > = ^^^^^^^ > The real bug is that this isn't initialized. > > 258bbf525e652e Kalle Valo 2019-02-05 545 = > 5cf3588467b76d Pradeep Kumar Chitrapu 2019-03-15 546 for (i =3D 0; = i < ab->num_radios; i++) { > 5cf3588467b76d Pradeep Kumar Chitrapu 2019-03-15 547 pdev =3D &ab-= >pdevs[i]; > 5cf3588467b76d Pradeep Kumar Chitrapu 2019-03-15 548 ar =3D pdev->= ar; > 5cf3588467b76d Pradeep Kumar Chitrapu 2019-03-15 @549 if (ar && ar-= >state =3D=3D ATH11K_STATE_ON) { > 5cf3588467b76d Pradeep Kumar Chitrapu 2019-03-15 550 radioup =3D = 1; > 5cf3588467b76d Pradeep Kumar Chitrapu 2019-03-15 551 break; > 5cf3588467b76d Pradeep Kumar Chitrapu 2019-03-15 552 } > 5cf3588467b76d Pradeep Kumar Chitrapu 2019-03-15 553 } > 258bbf525e652e Kalle Valo 2019-02-05 554 /* filter part= ial writes and invalid commands */ > 258bbf525e652e Kalle Valo 2019-02-05 555 if (*ppos !=3D= 0 || count >=3D sizeof(buf) || count =3D=3D 0) > 258bbf525e652e Kalle Valo 2019-02-05 556 return -EINVA= L; > 258bbf525e652e Kalle Valo 2019-02-05 557 = > 258bbf525e652e Kalle Valo 2019-02-05 558 rc =3D simple_= write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); > 258bbf525e652e Kalle Valo 2019-02-05 559 if (rc < 0) > 258bbf525e652e Kalle Valo 2019-02-05 560 return rc; > 258bbf525e652e Kalle Valo 2019-02-05 561 = > 258bbf525e652e Kalle Valo 2019-02-05 562 /* drop the po= ssible '\n' from the end */ > 258bbf525e652e Kalle Valo 2019-02-05 563 if (buf[*ppos = - 1] =3D=3D '\n') > 258bbf525e652e Kalle Valo 2019-02-05 564 buf[*ppos - 1= ] =3D '\0'; > 258bbf525e652e Kalle Valo 2019-02-05 565 = > 5cf3588467b76d Pradeep Kumar Chitrapu 2019-03-15 566 if (radioup = =3D=3D 0) { > ^^^^^= ^^^^^^^ > So this is meaningless. Why not check if (i =3D=3D ab->num_radios) inste= ad? Can someone from ath11k look at this report, please? -- = https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatc= hes --===============8579311690870986514==--