* Coverity: iommufd_vfio_iommu_get_info(): Code maintainability issues
@ 2022-11-02 19:55 coverity-bot
2022-11-02 20:06 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: coverity-bot @ 2022-11-02 19:55 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Jason Gunthorpe, Nicolin Chen, Gustavo A. R. Silva, linux-next,
linux-hardening
Hello!
This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221102 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:
Mon Oct 31 13:37:58 2022 -0300
32c328dc9b73 ("iommufd: vfio container FD ioctl compatibility")
Coverity reported the following:
*** CID 1527093: Code maintainability issues (UNUSED_VALUE)
/drivers/iommu/iommufd/vfio_compat.c: 411 in iommufd_vfio_iommu_get_info()
405 */
406 if (info.argsz >= total_cap_size)
407 info.cap_offset = sizeof(info);
408 info.argsz = total_cap_size;
409 info.flags |= VFIO_IOMMU_INFO_CAPS;
410 if (copy_to_user(arg, &info, minsz))
vvv CID 1527093: Code maintainability issues (UNUSED_VALUE)
vvv Assigning value "-14" to "rc" here, but that stored value is overwritten before it can be used.
411 rc = -EFAULT;
412 rc = 0;
413
414 out_put:
415 up_read(&ioas->iopt.iova_rwsem);
416 iommufd_put_object(&ioas->obj);
If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527093 ("Code maintainability issues")
Fixes: 32c328dc9b73 ("iommufd: vfio container FD ioctl compatibility")
This looks more like a "goto" is missing after the -EFAULT assignment?
Thanks for your attention!
--
Coverity-bot
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Coverity: iommufd_vfio_iommu_get_info(): Code maintainability issues
2022-11-02 19:55 Coverity: iommufd_vfio_iommu_get_info(): Code maintainability issues coverity-bot
@ 2022-11-02 20:06 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2022-11-02 20:06 UTC (permalink / raw)
To: coverity-bot
Cc: Nicolin Chen, Gustavo A. R. Silva, linux-next, linux-hardening
On Wed, Nov 02, 2022 at 12:55:21PM -0700, coverity-bot wrote:
> /drivers/iommu/iommufd/vfio_compat.c: 411 in iommufd_vfio_iommu_get_info()
> 405 */
> 406 if (info.argsz >= total_cap_size)
> 407 info.cap_offset = sizeof(info);
> 408 info.argsz = total_cap_size;
> 409 info.flags |= VFIO_IOMMU_INFO_CAPS;
> 410 if (copy_to_user(arg, &info, minsz))
> vvv CID 1527093: Code maintainability issues (UNUSED_VALUE)
> vvv Assigning value "-14" to "rc" here, but that stored value is overwritten before it can be used.
> 411 rc = -EFAULT;
> 412 rc = 0;
> 413
> 414 out_put:
> 415 up_read(&ioas->iopt.iova_rwsem);
> 416 iommufd_put_object(&ioas->obj);
>
> If this is a false positive, please let us know so we can mark it as
> such, or teach the Coverity rules to be smarter. If not, please make
> sure fixes get into linux-next. :) For patches fixing this, please
> include these lines (but double-check the "Fixes" first):
Yes, this is legit, we already fixed it
Thanks,
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-02 20:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-02 19:55 Coverity: iommufd_vfio_iommu_get_info(): Code maintainability issues coverity-bot
2022-11-02 20:06 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox