[SERVER-68817] Coverity analysis defect 122671: Dereference after null check Created: 14/Aug/22  Updated: 29/Oct/23  Resolved: 28/Oct/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Didier Nadeau
Resolution: Fixed Votes: 0
Labels: coverity, neweng, ordered
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Server Serverless 2022-08-22, Server Serverless 2022-10-31
Participants:

 Description   

Dereference after null check

Either the check against null is unnecessary, or there may be a null pointer dereference. Pointer is checked against null but then dereferenced anyway
/src/mongo/db/repl/tenant_migration_access_blocker_util.cpp:233: FORWARD_NULL 122671 Calling "this->donorMtab.operator bool()" implies that "this->donorMtab" might be null-like.
/src/mongo/db/repl/tenant_migration_access_blocker_util.cpp:236: FORWARD_NULL 122671 Attempting to access the managed object of an empty smart pointer "this->donorMtab".



 Comments   
Comment by Githook User [ 28/Oct/22 ]

Author:

{'name': 'Didier Nadeau', 'email': 'didier.nadeau@mongodb.com', 'username': 'nadeaudi'}

Message: SERVER-68817 Refactor tenant access blocking utils to address coverity warning
Branch: master
https://github.com/mongodb/mongo/commit/f1ba003f07afee1558cd56ccc7055e13a6e02d5a

Comment by Esha Maharishi (Inactive) [ 17/Aug/22 ]

Needs Triage discussion: we should refactor the code to directly check donorMtab and recipientMtab rather than having additional donorMtabStatus and recipientMtabStatus variables.

Generated at Thu Feb 08 06:11:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.