xfsdump cleaning patchset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys

I did some xfsdump cleaning where I focused on getting rid of all the
memory leaks reported by Coverity. There is still a lot of things to
do for another time: issues by Coverity that were not fixed in this
set, sprintf -> snprintf because there is a plenty of places for
buffer overflow, etc...

The set has about 30 patches, so I won't spam the mailing list with
the first iteration of review and instead, I uploaded it here:
https://github.com/jtulak/xfsdump/tree/for-review


The changes:

- Whitespace fixes. After speaking with Eric and because nobody
touches xfsdump anyway, I run a few sed commands and tried to fix the
crazy indentation to kernel style. It was an automated replacement, so
there can be places where it didn't work as intended, but in overall,
it helps with readability. Other whitespace issues I tackled are
trailing whitespaces.

- A lot of free(ptr) and close(fd). Xfsdump did not clean on errors,
so most of these are added to return -ERR; statements. These
after-error leaks were not an issue on itself, but it really polluted
the Coverity output.

- Other changes like dead code removal, null dereference, or
enlargement of a too small buffer for snprintf.


The patches are organised in this way:

- Whitespace issues are in two patches (indentation and trailing spaces).
- Resource leaks are one patch per file, with Coverity issue IDs (CID)
mentioned in the commit message for issues reported by the web scan. I
also used a custom instance of Coverity that reported some other
leaks, and those do not have any CID. If that seems still too
cluttered, I can break it to one patch per function, but that might
produce too many commits with two or three changes.
- And the remaining changes, like a dead code removal, are one patch
per issue/CID


I tested it as I could, but xfstests coverage is not large and part of
the tests requires a tape I don't have anyway. I also tested it with
valgrind to see if any errors got introduced, and from this
comparison, it came out clean (as much as I can tell when valgrind
throws 2k errors on me both pre and post patch).


Have a look.

Cheers,
Jan
--
Jan Tulak



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux