lkml.org 
[lkml]   [2016]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [RFC v1 08/14] bus1: implement peer management context
    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

    \
     
     \ /
      Last update: 2016-10-28 14:07    [W:4.134 / U:0.196 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site