Re: sparse annotation for error types?

2020-12-19 Thread Dan Carpenter
I've pushed my Smatch check for missing error codes. https://github.com/error27/smatch/commit/be18f90f05b684c12b80b9364b5bbc5dbef922da I ended up writing a slightly more tricky version of the check because there were some places that do: ret = 0; goto out; And I

Re: sparse annotation for error types?

2020-12-08 Thread Zhang Changzhong
On 2020/12/8 21:28, Dan Carpenter wrote: > Hi Zhang, > > Are you using Coccinelle to detect these bugs? In fact, I'm not familiar with Coccinelle, these bugs are reported by robot. > > On Sat, Dec 05, 2020 at 02:32:50PM -0800, Jakub Kicinski wrote: >> Hi! >> >> Recently we've been getting a

Re: sparse annotation for error types?

2020-12-08 Thread Dan Carpenter
Hi Zhang, Are you using Coccinelle to detect these bugs? On Sat, Dec 05, 2020 at 02:32:50PM -0800, Jakub Kicinski wrote: > Hi! > > Recently we've been getting a steady stream of patches from Changzhong > to fix missing assignment to error variables before jumping to error > cases. I've mucked

Re: sparse annotation for error types?

2020-12-05 Thread Luc Van Oostenryck
On Sat, Dec 05, 2020 at 03:10:15PM -0800, Linus Torvalds wrote: > On Sat, Dec 5, 2020 at 2:34 PM Jakub Kicinski wrote: > > > > Am I the only one who thinks this would be a good idea? > > err = third_step(obj, 0); > >err_undo_2s: > second_undo(obj); >err_undo_1s: >

Re: sparse annotation for error types?

2020-12-05 Thread Linus Torvalds
On Sat, Dec 5, 2020 at 2:34 PM Jakub Kicinski wrote: > > Am I the only one who thinks this would be a good idea? I don't think it's likely to be very useful, because a very common pattern is to not have that separate "return 0" in the middle, but more along the lines of err =

sparse annotation for error types?

2020-12-05 Thread Jakub Kicinski
Hi! Recently we've been getting a steady stream of patches from Changzhong to fix missing assignment to error variables before jumping to error cases. I wonder if for new code it'd make sense to add an annotation for a type which has to be returned non-zero? What I have in mind is the following