[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9rg4d2fbn2sUdgWAsn5svtY0jhQ0KsNMZZBg+aStcCWhA@mail.gmail.com>
Date: Thu, 9 Nov 2017 11:57:27 +0900
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Johannes Berg <johannes@...solutions.net>
Cc: David Miller <davem@...emloft.net>,
Netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
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@...solutions.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.
Powered by blists - more mailing lists