lkml.org 
[lkml]   [2020]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] keys: Make the KEY_NEED_* perms an enum rather than a mask
Date
Casey Schaufler <casey@schaufler-ca.com> wrote:

> > - if (perm & ~KEY_NEED_ALL)
> > - return -EINVAL;
> > + switch (need_perm) {
> > + default:
> > + return -EACCES;
> ...
> Is the change from -EINVAL to -EACCES a bug fix?
> Does it introduce an incompatibility?

It shouldn't happen. All the actual cases should be covered explicitly in the
switch. It's to catch a programming issue in the kernel where a new value
gets added to the enum but not propagated to all the places that check for it.

I'd actually prefer it to be something even more obvious, especially as EINVAL
is so widely used in the kernel. Should I put a WARN_ON in there?

David

\
 
 \ /
  Last update: 2020-05-14 01:27    [W:1.086 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site