The desired output should not be broken in conversion, which you did.
I dared to change another source code place a bit too much perhaps.
Do you know how syslog works and why the transformation is not correct.
I imagine that there are chances to improve the software situation a bit more,
aren't there?
I am also curious as to why you are patching joydump?
The discussed function implementation contains update candidates.
One of them was detected by the execution of a script for the semantic patch
language (Coccinelle software).
I identified further update possibilities after the opportunity for using
the function "kmalloc_array" also in this software module.
Are you working on extending it?
I attempted just another software refactoring.
Regards,
Markus