Re: [PATCH 2/4] selinux: do not allocate hashtabs dynamically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 1, 2020 at 10:20 PM Paul Moore <paul@xxxxxxxxxxxxxx> wrote:
> On Tue, Apr 28, 2020 at 8:55 AM Ondrej Mosnacek <omosnace@xxxxxxxxxx> wrote:
> >
> > It is simpler to allocate them statically in the corresponding
> > structure, avoiding unnecessary kmalloc() calls and pointer
> > dereferencing.
> >
> > Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
> > ---
> >  security/selinux/ss/hashtab.c  |  51 ++++---------
> >  security/selinux/ss/hashtab.h  |  13 ++--
> >  security/selinux/ss/mls.c      |  14 ++--
> >  security/selinux/ss/policydb.c | 126 ++++++++++++++++-----------------
> >  security/selinux/ss/policydb.h |   6 +-
> >  security/selinux/ss/services.c |  44 ++++++------
> >  security/selinux/ss/symtab.c   |   5 +-
> >  security/selinux/ss/symtab.h   |   2 +-
> >  8 files changed, 116 insertions(+), 145 deletions(-)
>
> Merged into selinux/next, thanks.

It looks like you didn't resolve the conflict with the return value
fix correctly. You left the line that sets rc to -ENOMEM, which is now
useless, because the value is immediately overwritten on the next
line:

        rc = -ENOMEM;
-       p->role_tr = hashtab_create(role_trans_hash, role_trans_cmp, nel);
-       if (!p->role_tr)
+       rc = hashtab_init(&p->role_tr, role_trans_hash, role_trans_cmp, nel);
+       if (rc)
               goto bad;

-- 
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux