[SERVER-37856] Coverity analysis defect 105090: Wrong operator used Created: 01/Nov/18  Updated: 29/Oct/23  Resolved: 05/Dec/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.1.7

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Esha Maharishi (Inactive)
Resolution: Fixed Votes: 0
Labels: coverity, sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2018-12-03, Sharding 2018-12-17
Participants:

 Description   

Wrong operator used in expression

Defect 105090 (STATIC_C)
Checker CONSTANT_EXPRESSION_RESULT (subcategory operator_confusion)
File: /src/mongo/db/write_concern.cpp
Function mongo::extractWriteConcern(mongo::OperationContext *, const mongo::BSONObj &)
/src/mongo/db/write_concern.cpp, line: 85
"opCtx->getClient()>session()>getTags() | 2U /* mongo::transport::Session::kInternalClient */" is always 1/true regardless of the values of its operand. This occurs as the logical second operand of "&&".

            (opCtx->getClient()->session()->getTags() | transport::Session::kInternalClient)) {



 Comments   
Comment by Githook User [ 05/Dec/18 ]

Author:

{'name': 'Esha Maharishi', 'email': 'esha.maharishi@mongodb.com', 'username': 'EshaMaharishi'}

Message: SERVER-37856 Fix coverity analysis defect 105090: Wrong operator used
Branch: master
https://github.com/mongodb/mongo/commit/ff83812e30f1eb8bbdfb5060f556d92025e4f888

Comment by Esha Maharishi (Inactive) [ 03/Dec/18 ]

Oh, lol.

Comment by Kaloian Manassiev [ 02/Dec/18 ]

FYI - this came from this commit and essentially makes the change for SERVER-34212 a no-op. It's just a matter of changing the "|" to "&" - hopefully Evergreen is all green.

Generated at Thu Feb 08 04:47:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.