[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNia23bDCGRZ74OG@kroah.com>
Date: Sun, 27 Jun 2021 17:35:55 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Matthew Wilcox <willy@...radead.org>, Arnd Bergmann <arnd@...db.de>
Cc: Roberto Sassu <roberto.sassu@...wei.com>, zohar@...ux.ibm.com,
linux-integrity@...r.kernel.org,
linux-security-module@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH 03/12] digest_lists: Basic definitions
On Sun, Jun 27, 2021 at 04:23:26PM +0100, Matthew Wilcox wrote:
> On Sun, Jun 27, 2021 at 12:53:47PM +0200, Greg KH wrote:
> > > +enum ops { DIGEST_LIST_ADD, DIGEST_LIST_DEL, DIGEST_LIST_OP__LAST };
> > > +
> >
> > For enums you export to userspace, you need to specify the values so
> > that all compilers get them right.
>
> I've never heard that rule before. Where does it come from?
> https://en.cppreference.com/w/c/language/enum
> says:
>
> If enumeration-constant is not followed by = constant-expression,
> its value is the value one greater than the value of the previous
> enumerator in the same enumeration. The value of the first enumerator
> (if it does not use = constant-expression) is zero.
>
I thought it was in the Documentation/driver-api/ioctl.rst file, but I
can't find it right now. Maybe it was something that Arnd said?
Arnd, is this still an issue? For some reason I thought it was always
good to have uapi .h enums be explicit as to the value in them,
otherwise some C compilers might produce other values if they were not
specified?
thanks,
greg k-h
Powered by blists - more mailing lists