Messages in this thread | | | From | "Jason A. Donenfeld" <> | Date | Thu, 9 Nov 2017 11:57:27 +0900 | Subject | Re: [PATCH v3] af_netlink: ensure that NLMSG_DONE never fails in dumps |
| |
On Thu, Nov 9, 2017 at 11:02 AM, Johannes Berg <johannes@sipsolutions.net> wrote: > nit: I think your line got a little long here :)
Ack. For v4.
> and here
Ack. For v4.
> >> + nlk->dump_done_errno = INT_MAX; > > I guess positive values aren't really returned from dump?
When a positive value is returned, the API uses this to signify that the dump is not done, and it should be called again. When 0 or negative is returned, it means the dump is complete and the return value should be returned in DONE. We therefore initialize dump_done_errno to some positive value, so that we can make calling ->dump() conditional on it being positive. When it becomes zero or negative, it's time to return. This mirrors the semantics of the actual ->dump() function precisely.
| |