Closed Bug 1167410 Opened 10 years ago Closed 10 years ago

Value stored to 'eTLD' during its initialization is never read in nsEffectiveTLDService::GetBaseDomainInternal

Categories

(Core :: Networking: DNS, defect)

defect
Not set
trivial

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox41 --- affected
firefox42 --- fixed

People

(Reporter: ritu, Assigned: ritu, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: clang-analyzer, Whiteboard: [lang=c++])

Attachments

(1 file, 3 obsolete files)

+++ This bug was initially created as a clone of Bug #1144625 +++ Dead initialization. See fx-scan report at: https://people.mozilla.org/~sledru/reports/fx-scan-build/report-nsEffectiveTLDService.cpp-GetBaseDomainInternal-27-1.html#EndPath Value stored to 'eTLD' during its initialization is never read in nsEffectiveTLDService::GetBaseDomainInternal. Line 254.
Cloning the bug automatically added a depends on the original bug. Removing it as that's not needed.
No longer depends on: 1144625
If it's OK I'd like to take care of this.
Marco, sorry but Ritu has been working on it already.
No problem.
Attached patch patch.diff (obsolete) — Splinter Review
Submitting a patch for review.
Ritu, you should now look for a reviewer for your patch :) Usually, I look at the hg history to find the owner of the code.
Flags: needinfo?(rkothari)
Assignee: nobody → rkothari
Comment on attachment 8610715 [details] [diff] [review] patch.diff Requesting review on the patch I submitted. Thanks.
Attachment #8610715 - Flags: review?(continuation)
Comment on attachment 8610715 [details] [diff] [review] patch.diff Review of attachment 8610715 [details] [diff] [review]: ----------------------------------------------------------------- ::: netwerk/dns/nsEffectiveTLDService.cpp @@ +250,5 @@ > const char *prevDomain = nullptr; > const char *currDomain = aHostname.get(); > const char *nextDot = strchr(currDomain, '.'); > const char *end = currDomain + aHostname.Length(); > + const char *eTLD; //Initialization was never used so commenting it out = currDomain; This comment is a bit redundant. I'd just remove it entirely. (Just upload a new version of the patch when you have it and obsolete this version.) It looks like I have done a number of reviews in this file, but they were actually just for wide-spread data structure changes. For this change, you should get a networking peer to review it ( https://wiki.mozilla.org/Modules/Core#Necko ). You could try Nick Hurley.
Attachment #8610715 - Flags: review?(continuation)
Thanks Andrew! I will do that.
Comment on attachment 8610715 [details] [diff] [review] patch.diff Will upload a new patch soon.
Attachment #8610715 - Attachment is obsolete: true
Attached patch patchv2.diff (obsolete) — Splinter Review
patch v2
Attachment #8614909 - Flags: review?(hurley)
That patch looks like a diff from the old patch, but you should upload a patch that is both of these combined, so that it is the diff from trunk.
Comment on attachment 8614909 [details] [diff] [review] patchv2.diff Review of attachment 8614909 [details] [diff] [review]: ----------------------------------------------------------------- Like :mccr8 said, please upload a new patch that has the full change, from current in-tree version to your latest version.
Attachment #8614909 - Flags: review?(hurley)
Also, looking at this, I'm not sure this is anything other than noise in the clang-analyzer output. The way the code is now, the default eTLD (currDomain) is relatively obvious, but changing the default to nullptr hides the default value way down in that not-quite-infinite loop. I'll have to think on it a bit more.
Attached patch patchv3.diff (obsolete) — Splinter Review
Patch v3 submitted.
Attachment #8616838 - Flags: review?(hurley)
Comment on attachment 8616838 [details] [diff] [review] patchv3.diff Review of attachment 8616838 [details] [diff] [review]: ----------------------------------------------------------------- ::: netwerk/dns/nsEffectiveTLDService.cpp @@ +250,5 @@ > const char *prevDomain = nullptr; > const char *currDomain = aHostname.get(); > const char *nextDot = strchr(currDomain, '.'); > const char *end = currDomain + aHostname.Length(); > + const char *eTLD = nullptr; Add a comment explaining that the default value is currDomain, as set in that while loop below, in order to make the code as readable as it is with this line that clang-analyzer complained about. Then we'll be good to go.
Attachment #8616838 - Flags: review?(hurley)
Attached patch patchv3.diffSplinter Review
With the additional comment suggested by Nicholas.
Attachment #8616838 - Attachment is obsolete: true
Attachment #8626772 - Flags: review?(hurley)
Comment on attachment 8626772 [details] [diff] [review] patchv3.diff Review of attachment 8626772 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me, thanks!
Attachment #8626772 - Flags: review?(hurley) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: