public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* xfsdump cleaning patchset
@ 2018-10-22 17:26 Jan Tulak
  2018-10-22 17:43 ` Christoph Hellwig
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Tulak @ 2018-10-22 17:26 UTC (permalink / raw)
  To: linux-xfs; +Cc: Eric Sandeen

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-10-23 22:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-22 17:26 xfsdump cleaning patchset Jan Tulak
2018-10-22 17:43 ` Christoph Hellwig
2018-10-22 18:07   ` Eric Sandeen
2018-10-22 19:25     ` Eric Sandeen
2018-10-23  8:16       ` Jan Tulak
2018-10-23 12:10         ` Eric Sandeen
2018-10-23 13:15           ` Jan Tulak
2018-10-23 13:43             ` Eric Sandeen
2018-10-23 14:06               ` Jan Tulak
2018-10-23 14:34                 ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox