Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756414AbcJ1MHA (ORCPT ); Fri, 28 Oct 2016 08:07:00 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:34368 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752803AbcJ1MG6 (ORCPT ); Fri, 28 Oct 2016 08:06:58 -0400 MIME-Version: 1.0 In-Reply-To: <20161026191810.12275-9-dh.herrmann@gmail.com> References: <20161026191810.12275-1-dh.herrmann@gmail.com> <20161026191810.12275-9-dh.herrmann@gmail.com> From: Richard Weinberger Date: Fri, 28 Oct 2016 14:06:56 +0200 Message-ID: Subject: Re: [RFC v1 08/14] bus1: implement peer management context To: David Herrmann Cc: LKML , Andy Lutomirski , Jiri Kosina , Greg KH , Hannes Reinecke , Steven Rostedt , Arnd Bergmann , Tom Gundersen , Josh Triplett , Linus Torvalds , Andrew Morton Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 917 Lines: 30 David, Tom, On Wed, Oct 26, 2016 at 9:18 PM, David Herrmann 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