Le 21/02/2023 à 23:24, Dan Carpenter a écrit :
Hi,
Hi Dan,
I've written a new check for missing error codes. It assumes that most gotos are error paths (which turns out to be a wrong assumption) but still the results are kind of interesting. I'm thinking that it maybe should only warn for a few types of things: 1) p = frob(); if (!p) { p is a pointer and it was assigned from a function. And the function doesn't return a mix of error pointers and NULL.
1') int ret; p = frob(&ret); if (!ret) { (such kind of patterns break my coccinelle checks for similar issues)
2) if (IS_ERR(p)) { error pointers. Obvious.
2') if (IS_ERR_OR_NULL(p)) {
3) if (frob()) { frob() is a function that returns negatives.
3') if (!frob()) { frob() is a function that returns NULL.
4) if (x > y) { bounds checking 5) when there is a dev_err() after the if statement.
or der_err_probe()
Anything else that indicates an error path? regards, dan carpenter