Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1559885

Re: [PATCH 00/46] SELinux: Fine-tuning for several function implementations

From Paul Moore <paul@paul-moore.com>
Newsgroups linux.kernel
Subject Re: [PATCH 00/46] SELinux: Fine-tuning for several function implementations
Date 2017-01-16 17:50 +0100
Message-ID <t0iDL-30L-9@gated-at.bofh.it> (permalink)
References <sZUrL-3Jh-9@gated-at.bofh.it> <t0hol-2dP-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jan 16, 2017 at 10:26 AM, Eric Paris <eparis@redhat.com> wrote:
> <opinion from irrelevant person>

Well, not totally irrelevant, I just reserve the right to ignore Eric
if I disagree with him ;)

> All of the patches look good to me except most of those which change
> the handling of `rc=`. I have a personal style preference for
>
> rc = -ENOMEM;
> val = kalloc();
> if (!val)
>   goto err;
>
> vs
>
> val = kalloc();
> if (!val) {
>   rc = -ENOMEM;
>   goto err;
> }
>
> because it saves 1 line and I think the compiler does the right/same
> thing. If there is preference among the people active in selinux
> developers (like I said, I'm now irrelevant) I guess they win.

My preference tends to be the other way around; I think putting the rc
assignment in the if block makes the code more readable and that is
how I tend to write things.  That said, I don't recall ever requiring
someone to redo a patch only because of this style nit ... if I did,
shame on me.

> But certainly a big +1 from me for the array allocation and sizeof()
> changes.

I do appreciate all the patches, thank you!  However, a bit of a
warning that it may take me a little bit of time to work my way
through reviewing and merging all of them.

-- 
paul moore
www.paul-moore.com

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/46] SELinux: Fine-tuning for several function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:00 +0100
  [PATCH 02/46] selinux: Delete an unnecessary return statement in  cond_compute_av() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:00 +0100
  [PATCH 01/46] selinux: Use kmalloc_array() in  cond_init_bool_indexes() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:00 +0100
  [PATCH 04/46] selinux: Use kmalloc_array() in hashtab_create() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:10 +0100
  [PATCH 05/46] selinux: Adjust four checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:10 +0100
  [PATCH 07/46] selinux: Delete unnecessary variable assignments in  policydb_index() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:10 +0100
    Re: [PATCH 07/46] selinux: Delete unnecessary variable assignments in  policydb_index() Casey Schaufler <casey@schaufler-ca.com> - 2017-01-17 17:40 +0100
  [PATCH 09/46] selinux: Delete an error message for a failed memory  allocation in policydb_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:10 +0100
  [PATCH 08/46] selinux: Delete an unnecessary return statement in  policydb_destroy() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:10 +0100
  [PATCH 03/46] selinux: Improve size determinations in four functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:10 +0100
  [PATCH 06/46] selinux: Use kcalloc() in policydb_index() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:10 +0100
  [PATCH 18/46] selinux: One function call less in  filename_trans_read() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:20 +0100
  [PATCH 17/46] selinux: Delete an unnecessary variable assignment in  filename_trans_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:20 +0100
  [PATCH 11/46] selinux: Return directly after a failed next_entry() in  genfs_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:20 +0100
  [PATCH 15/46] selinux: One check and function call less in  genfs_read() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:20 +0100
    Re: [PATCH 15/46] selinux: One check and function call less in  genfs_read() after error detection Casey Schaufler <casey@schaufler-ca.com> - 2017-01-17 17:40 +0100
      Re: [PATCH 15/46] selinux: One check and function call less in  genfs_read() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-17 17:40 +0100
        Re: [PATCH 15/46] selinux: One check and function call less in  genfs_read() after error detection Casey Schaufler <casey@schaufler-ca.com> - 2017-01-17 19:00 +0100
  [PATCH 16/46] selinux: Move two assignments for the variable "rc" in  filename_trans_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:20 +0100
  [PATCH 13/46] selinux: Move four assignments for the variable "rc" in  genfs_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:20 +0100
  [PATCH 14/46] selinux: One function call less in genfs_read() after  null pointer detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:20 +0100
  [PATCH 19/46] selinux: Return directly after a failed next_entry() in  range_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:20 +0100
  [PATCH 10/46] selinux: Move some assignments for the variable "rc" in  policydb_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:20 +0100
  [PATCH 12/46] selinux: Move assignments for two pointers in  genfs_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:20 +0100
  [PATCH 28/46] selinux: Return directly after a failed kzalloc() in  user_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:30 +0100
  [PATCH 20/46] selinux: Move four assignments for the variable "rc" in  range_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:30 +0100
  [PATCH 24/46] selinux: Return directly after a failed kzalloc() in  cat_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:30 +0100
  [PATCH 21/46] selinux: Two function calls less in range_read() after  error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:30 +0100
    Re: [PATCH 21/46] selinux: Two function calls less in range_read()  after error detection Casey Schaufler <casey@schaufler-ca.com> - 2017-01-17 17:40 +0100
  [PATCH 23/46] selinux: Move an assignment for a pointer in  range_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:30 +0100
  [PATCH 29/46] selinux: Return directly after a failed kzalloc() in  type_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:30 +0100
  [PATCH 25/46] selinux: Return directly after a failed kzalloc() in  sens_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:30 +0100
  [PATCH 26/46] selinux: Improve another size determination in  sens_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:30 +0100
  [PATCH 27/46] selinux: Move an assignment for the variable "rc" in  sens_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:30 +0100
  [PATCH 22/46] selinux: Delete an unnecessary variable initialisation  in range_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:30 +0100
  [PATCH 35/46] selinux: Return directly after a failed kzalloc() in  perm_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:40 +0100
  [PATCH 32/46] selinux: Return directly after a failed kzalloc() in  class_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:40 +0100
  [PATCH 39/46] selinux: Move two assignments for the variable "rc" in  ocontext_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:40 +0100
  [PATCH 33/46] selinux: Move an assignment for the variable "rc" in  class_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:40 +0100
  [PATCH 37/46] selinux: Move an assignment for the variable "rc" in  policydb_load_isids() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:40 +0100
  [PATCH 38/46] selinux: One function call less in five functions after  null pointer detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:40 +0100
  [PATCH 30/46] selinux: Return directly after a failed kzalloc() in  role_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:40 +0100
  [PATCH 31/46] selinux: Move an assignment for the variable "rc" in  role_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:40 +0100
  [PATCH 36/46] selinux: Move an assignment for the variable "rc" in  mls_read_range_helper() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:40 +0100
  [PATCH 34/46] selinux: Return directly after a failed kzalloc() in  common_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:40 +0100
  [PATCH 45/46] selinux: Use common error handling code in  sidtab_insert() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:50 +0100
    Re: [PATCH 45/46] selinux: Use common error handling code in  sidtab_insert() Casey Schaufler <casey@schaufler-ca.com> - 2017-01-17 19:10 +0100
  [PATCH 44/46] selinux: Adjust two checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:50 +0100
  [PATCH 40/46] selinux: Return directly after a failed kzalloc() in  roles_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:50 +0100
  [PATCH 46/46] selinuxfs: Use seq_puts() in sel_avc_stats_seq_show() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:50 +0100
  [PATCH 43/46] selinux: Use kmalloc_array() in sidtab_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:50 +0100
  [PATCH 42/46] selinux: One function call less in roles_init() after  error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:50 +0100
  [PATCH 41/46] selinux: Move two assignments for the variable "rc" in  roles_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-15 16:50 +0100
  Re: [PATCH 00/46] SELinux: Fine-tuning for several function  implementations Eric Paris <eparis@redhat.com> - 2017-01-16 16:30 +0100
    Re: [PATCH 00/46] SELinux: Fine-tuning for several function implementations Paul Moore <paul@paul-moore.com> - 2017-01-16 17:50 +0100
    Re: SELinux: Checking source code positions for the setting of error  codes SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-16 19:40 +0100

csiph-web