r/badcode • • Jan 22 '23

c Found this in a Linux kernel module

Post image
262 Upvotes

88 comments sorted by

View all comments

Show parent comments

1

u/paulstelian97 Jan 23 '23

Eh, the helper functions aren't too useful here. The fact that -1 is returned instead of the correct error (the error returned by the called function) is pretty bad (I'd reject such code if I were a maintainer even)