Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1511083

Re: [RFC v1 08/14] bus1: implement peer management context

From Richard Weinberger <richard.weinberger@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC v1 08/14] bus1: implement peer management context
Date 2016-10-28 14:10 +0200
Message-ID <sxe8V-885-3@gated-at.bofh.it> (permalink)
References <swC3D-87o-1@gated-at.bofh.it> <swC3D-87o-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


David, Tom,

On Wed, Oct 26, 2016 at 9:18 PM, David Herrmann <dh.herrmann@gmail.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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [RFC v1 08/14] bus1: implement peer management context Richard Weinberger <richard.weinberger@gmail.com> - 2016-10-28 14:10 +0200
  Re: [RFC v1 08/14] bus1: implement peer management context Tom Gundersen <teg@jklm.no> - 2016-10-28 15:20 +0200
    Re: [RFC v1 08/14] bus1: implement peer management context Richard Weinberger <richard@nod.at> - 2016-10-28 15:30 +0200

csiph-web