[Bug 240545] patch to remove unneeded M_WAITOK return value checks
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sun Oct 6 18:36:46 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240545
--- Comment #8 from Conrad Meyer <cem at freebsd.org> ---
There's some way of declaring that a coccinelle variable ('buf') hasn't been
reassigned since the earlier malloc call, although I don't recall how to do it.
E.g., in this code,
buf = malloc(M_WAITOK);
...
buf = malloc(M_NOWAIT);
if (buf == NULL) {
/* this case shouldn't be removed */
}
The null check shouldn't be removed.
It's a weird and probably bad pattern to reuse the same C variable for
allocation with a different policy in the same function, but possible.
> Still need to look through / basic test the generated patch, but wanted to share the Coccinelle spatch.
Thanks!
> It took a long time (at least 12 hours) to run on the src/sys tree.
Yeah, it's not fast.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list