1 # How to review a patch
3 Some folks have said that they'd like to review patches more often, but they
6 So, here are a bunch of things to check for when reviewing a patch!
8 Note that if you can't do every one of these, that doesn't mean you can't do
9 a good review! Just make it clear what you checked for and what you didn't.
11 ## Top-level smell-checks
15 - Does it compile with `--enable-fatal-warnings`?
17 - Does `make check-spaces` pass?
19 - Does `make check-changes` pass?
21 - Does it have a reasonable amount of tests? Do they pass? Do they leak
24 - Do all the new functions, global variables, types, and structure members have
27 - Do all the functions, global variables, types, and structure members with
28 modified behavior have modified documentation?
30 - Do all the new torrc options have documentation?
32 - If this changes Tor's behavior on the wire, is there a design proposal?
34 - If this changes anything in the code, is there a "changes" file?
37 ## Let's look at the code!
39 - Does the code conform to `CodingStandards.md`?
41 - Does the code leak memory?
43 - If two or more pointers ever point to the same object, is it clear which
44 pointer "owns" the object?
46 - Are all allocated resources freed?
48 - Are all pointers that should be const, const?
50 - Are `#defines` used for 'magic' numbers?
52 - Can you understand what the code is trying to do?
54 - Can you convince yourself that the code really does that?
56 - Is there duplicated code that could be turned into a function?
59 ## Let's look at the documentation!
61 - Does the documentation conform to CodingStandards.txt?
65 - Can you predict what the function will do from its documentation?
68 ## Let's think about security!
70 - If there are any arrays, buffers, are you 100% sure that they cannot
73 - If there is any integer math, can it overflow or underflow?
75 - If there are any allocations, are you sure there are corresponding
78 - Is there a safer pattern that could be used in any case?
80 - Have they used one of the Forbidden Functions?
82 (Also see your favorite secure C programming guides.)