valgrind warnings writing uninitialized memory to disk cache

RESOLVED FIXED

Status

()

Core
Networking: Cache
RESOLVED FIXED
11 years ago
10 years ago

People

(Reporter: dbaron, Assigned: dbaron)

Tracking

({valgrind})

Trunk
x86
Linux
valgrind
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [patch])

Attachments

(1 attachment)

(Assignee)

Description

11 years ago
I originally reopened bug 184614 for this, but I'm filing it now as a separate bug.

On startup, I reliably see a valgrind warning about writing uninitialized memory to disk cache.  One of those warnings is in attachment 252679 [details].

I noticed the problem may be to the effect of mKeyStart on sizeof(nsDiskCacheEntry).
(Assignee)

Comment 1

11 years ago
In particular, the sizeof(nsDiskCacheEntry) math in CreateDiskCacheEntry, which could use the offsetof trick that nsDiskCacheEntry::Size uses, or we could just get rid of mKeyStart, which is pretty easy as well.
(Assignee)

Comment 2

11 years ago
Created attachment 252691 [details] [diff] [review]
patch

This removes the mKeyStart (which presumably adds 3 bytes of padding for the alignment as well), so that sizeof(nsDiskCacheEntry) is less confusing.  The substantive change this should be causing is reducing the size calculation in CreateDiskCacheEntry, which does two things:
 * reduces the amount of memory allocated
 * reduces the |size| returned to nsDiskCacheMap::WriteDiskCacheEntry

The latter change changes the file index; therefore I chose to bump the cache version, although I'm not sure if that's needed.
Assignee: nobody → dbaron
Status: NEW → ASSIGNED
Attachment #252691 - Flags: superreview?
Attachment #252691 - Flags: review?
(Assignee)

Updated

11 years ago
Attachment #252691 - Flags: superreview?(darin.moz)
Attachment #252691 - Flags: superreview?
Attachment #252691 - Flags: review?(darin.moz)
Attachment #252691 - Flags: review?
(Assignee)

Updated

11 years ago
Whiteboard: [patch]

Updated

11 years ago
Attachment #252691 - Flags: superreview?(darin.moz)
Attachment #252691 - Flags: superreview+
Attachment #252691 - Flags: review?(darin.moz)
Attachment #252691 - Flags: review+
(Assignee)

Comment 3

11 years ago
Checked in to trunk.
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
Keywords: valgrind
You need to log in before you can comment on or make changes to this bug.