[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFLxGvzAQQdKMEDyO-9cWV3EydppCmVNQzikQ0K5jyhBMbRM8Q@mail.gmail.com>
Date: Fri, 28 Oct 2016 14:06:56 +0200
From: Richard Weinberger <richard.weinberger@...il.com>
To: David Herrmann <dh.herrmann@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...capital.net>,
Jiri Kosina <jikos@...nel.org>, Greg KH <greg@...ah.com>,
Hannes Reinecke <hare@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Arnd Bergmann <arnd@...db.de>, Tom Gundersen <teg@...m.no>,
Josh Triplett <josh@...htriplett.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC v1 08/14] bus1: implement peer management context
David, Tom,
On Wed, Oct 26, 2016 at 9:18 PM, David Herrmann <dh.herrmann@...il.com> wrote:
> +struct bus1_peer *bus1_peer_new(void)
> +{
> + static atomic64_t peer_ids = ATOMIC64_INIT(0);
> + const struct cred *cred = current_cred();
> + struct bus1_peer *peer;
> + struct bus1_user *user;
> +
> + user = bus1_user_ref_by_uid(cred->uid);
> + if (IS_ERR(user))
> + return ERR_CAST(user);
> +
> + peer = kmalloc(sizeof(*peer), GFP_KERNEL);
> + if (!peer) {
> + bus1_user_unref(user);
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + /* initialize constant fields */
> + peer->id = atomic64_inc_return(&peer_ids);
What is the purpose of this id? Do other components depend on it
and are they aware of possible overflows?
Since it is an 64bit integer overflowing it is hard but not impossible.
--
Thanks,
//richard
Powered by blists - more mailing lists