On 11 December 2014 at 03:31, Rafael J. Wysocki rjw@rjwysocki.net wrote:
I've lost patches [1-2/5] somehow, but never mind. I can get them from Patchwork.
Strange, you were always in --to for them ..
In this one I'm wondering about the printk removal mentioned above. Did checkpatch complain about the printk?
commit ebfdc40969f24fc0cdd1349835d36e8ebae05374 Author: Joe Perches joe@perches.com Date: Wed Aug 6 16:10:27 2014 -0700
checkpatch: attempt to find unnecessary 'out of memory' messages
Logging messages that show some type of "out of memory" error are generally unnecessary as there is a generic message and a stack dump done by the memory subsystem.
These messages generally increase kernel size without much added value.
Emit a warning on these types of messages.
This test looks for any inserted message function, then looks at the previous line for an "if (!foo)" or "if (foo == NULL)" test and then looks at the preceding statement for an allocation function like "foo = kmalloc()"
ie: this code matches:
foo = kmalloc(); if (foo == NULL) { printk("Out of memory\n"); return -ENOMEM; }
This test is very crude and incomplete.
This test can miss quite a lot of of OOM messages that do not have this specific form.
ie: this code does not match:
foo = kmalloc(); if (!foo) { rtn = -ENOMEM; printk("Out of memory!\n"); goto out; }
This test could also be a false positive when the logging message itself does not specify anything about memory, but I did not find any false positives in my limited testing.
spatch could be a better solution but correctness seems non-trivial for that tool too.